< Previous | Contents | Next >

Creating a while (true)

Loop

I set up the loop with the following line:

while (true)

Technically, this creates an infinite loop. This might seem odd coming so soon after a warning to avoid infinite loops, but this particular loop isnt really infinite because I put an exit condition in the loop body.


Hi n t

image

Although a while (true) loop sometimes can be clearer than a traditional loop, you should also try to minimize your use of these loops.

image