The Problem

In an infinite loop, the code repeats itself ad infinitum, until the program crashes or the user loses their mind.

			if (true) {
				print("Hello, World!");
			}
		

But fear not, for we have the solution: Looping Logic.

The Solution

It's quite simple really. Just add a little twist to your code.

			if (true) {
				print("Hello, World!");
			} else {
				print("Goodbye, World!");
			}
		

Voila! Now your program will only print "Hello, World!" once, and then "Goodbye, World!" forevermore.

But wait, there's more! You can also add a third option:

			if (true) {
				print("Hello, World!");
			} else {
				print("Goodbye, World!");
			} else {
				print("Maybe, World!");
			}
		

And now your program will print a delightful mix of "Hello, World!" and "Goodbye, World!", with the occasional "Maybe, World!" thrown in for good measure.

Learn about MultiThreaded Mayhem