mercredi 23 mars 2016

How do I make an if statement for 3 variables?

I have had some problems with some code I have but I have managed to source the problem and I have nearly found a way to fix it. When I change the number at the end of maximum_guesses to maximum_guesses1, maximum_guesses2 and maximum_guesses3 the code works fine. However, when I have duplicated it and changed the number at the end of the maximum_guessses the number of guesses count as three when it should only be one.

How do I make the code below work for all three maximum_guesses?

maximum_guesses1, maximum_guesses2, maximum_guesses3

number_of_guesses++; 
if (number_of_guesses > maximum_guesses3)
{
window.alert("Sorry, you have run out of guesses!");
return;
}

Aucun commentaire:

Enregistrer un commentaire