thanks,
I appreciate your help
Printable View
thanks,
I appreciate your help
I notice that a lot of people write returns as you have ... with a number of return statements. An instructor I greatly respect drilled into my head that, for safety, you whould provide only one return from a module. Yes, it involves the creation of a temporary variable, but one of all of those returns can slip by your view or you might forget one ... so, think about creating a temporary boolean which is initialized as false, gets changed to true only if the condition is met, then you return the value of the temporary variable ...
But, working with your code, you need to reference the array to get the score for the week, and then you didn't add the "update score" portion of the code:
Code:
if( hwScores[week] != 0 )
{
return false;
}
else
{
hwScores[week] = score;
return true;
}