# i am not getting it

 girish gogia · June 23, 2015 I am not getting this if statement properly . this is the link to the tutorial:https://www.youtube.com/watch?v=_LDN79j5H5s&list=PL6gx4Cwl9DGAKIXv8Yr6nhGJ9Vlcjyymq&index=40if(ppg > bestPPG){            bestPPG = ppg;            bestPlayer = player;        }^^ this is what i am having problem with.

## Replies

 c student · June 24, 2015 Look around the forum.  There have already been answers for this. Kenneth Malicay · June 24, 2015 it means every loop it checks whether the player's PPG is greater than the current bestPPG and if yes then it would overwrite the current bestPPG and select the bestPlayer as the current player on the loop and it would loop again to check the next player and check it again and again as long as there are players left.edit:e.g.best points per game = 0First loop  points per game = goals / games played  since first player's points per game is 0.87 then  set best points per game = 0.87Second loop  ppg = goals / gamesPlayed  since second player's ppg is 1.3 then  set bestPPG = 1.3Third loop  ppg = goals / gamesPlayed  since third player's ppg is 0.89  it would not go inside the loop because ppg is 0.89 which is less than bestPPG which is 1.3.and so on... girish gogia · June 25, 2015 bestPPG = ppg;bestPlayer = player; what does this mean? Kenneth Malicay · June 25, 2015 e.g.``int player[5] = {58,66,68,71,87};int bestPlayer;float ppg[5] = {0.87,1.3,0.89,0.97,1.19};float bestPPG = 0.0;for(i = 0; i < 5; i++) { if(ppg[i] > bestPPG) { // if ppg[i] is greater than bestPPG replace bestPPG value by ppg[i] bestPPG = ppg[i]; // since ppg[i] and player[i] is on the same index, // if ppg[i] is the best then player[i] is the best too, // so set player[i] as bestPlayer bestPlayer = player[i]; }}``I removed the other codes and just hardcoded the ppg.This is the simplest it could get so if you still don't get this I don't know how else I could help you. girish gogia · June 26, 2015 thank you
• 1

## C

126,560 followers