C# C# Basics (Retired) Perform if / else

When to say 'Bye bye'

Why not put the 'Bye bye'-message inside the if-statement? Like:

if (entry == "quit") { keepGoing = false; Console.WriteLine("Bye bye"); }

1 Answer

Matthew Lang
Matthew Lang
13,464 Points

That would also work. There's always many ways of doing something, some better than others. I think maybe this was to demonstrate that once the while loop ended, it continues with the rest of the code below it.