Однако код бесконечно выполняет что-то еще.
Код: Выделить всё
public class Quiz{
//Make various questions with correct/incorrect options
/*
* Suggestion
* Question 1
* How old was the first king of sweden when he passed?
* Options1
* 40
* 60
* 80
*/
public static int correctAnswer = 40;
public static int guess = Convert.ToInt32(Console.ReadLine());
public static void Guess(){
System.Console.WriteLine("How old was the 1st King of Sweden\n");
System.Console.WriteLine("when he passed away?");
while(guess != correctAnswer){
if(guess == correctAnswer){
System.Console.WriteLine("Correct answer. Congratulations.");
} else{
System.Console.WriteLine("Try again.");
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/789 ... itely-long