I made simple program. I want to stop it when the user enters "5".
Relevant code:
do {
System.out.println("Enter 5 to quit");
a = scanner.nextInt();
b = a==5;
} while (b = true);
Of course earlier I named variables (int a, boolean b etc.)
Why doesn't it work when I type:
}while (b ==5)
PS. Is there a way to refactor code (while change to for)?
while (b = true);
while (b == true);
or
while (a!=5);