POV-Ray : Documentation : 1.3.9.1 What a while-loop is and what it is not
  POV-Ray 3.6 Documentation Online View  
1.3.9 While-loop tutorial   1.3.9.2 How does a single while-loop work?

1.3.9.1 What a while-loop is and what it is not

A while-loop in POV-Ray is just a control structure which tells POV-Ray to loop a command block while the specified condition is true (ie. until it gets false).

That is, a while-loop is like this:

#while(condition)
  ...
#end

The commands between #while and #end are run over and over as long as the condition evaluates to true.

A while-loop is not a for-loop nor any kind of loop which has an index variable by itself (which may be incremented automatically in each loop).

The while-loop does not care what the conditions are between the parentheses (as long as they evaluate to some value) or what does the block between #while and #end contain. It will just execute that block until the condition becomes false.

The while-loop does not do anything else. You can think about it as a kind of "dumb" loop, which does not do anything automatically (and this is not necessarily a bad thing).

1.3.9 While-loop tutorial   1.3.9.2 How does a single while-loop work?


Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.