The program's goal is to roll two dice until both of them equal 6. When I used && in the while statement it stops after one dice equals 6. Why is that? Shouldn't && test the first condition then if it is correct test the second?
while ((diceOne != 6) || (diceTwo != 6)) {
diceOne = numberGeneration.Next(1, 7);
diceTwo = numberGeneration.Next(1, 7);
attempt = ++attempt;
Console.WriteLine("Your first dice is: " + diceOne + " your second dice is: " + diceTwo);
Console.WriteLine("Press any button to continue");
Console.ReadKey();
}
Console.WriteLine("It took you " + attempt);
Console.WriteLine("Press any key to continue");
Console.ReadKey();
Aucun commentaire:
Enregistrer un commentaire