When is while(true) true, and when is it false?

It’s always true, it’s never false.

Some people use while(true) loops and then use break to exit them when a certain condition is true, but it’s generally quite sloppy practice and not recommended. Without the use of breakreturnSystem.exit(), or some other such mechanism, it will keep looping forever.

Leave a Reply

Your email address will not be published. Required fields are marked *