Realization in POV-Ray
|
Types of Loops
|
Other Programming Languages
|
#while (condition)
... statements
#end |
Prechecked Loop
"While Loop"
WHILE (condition)
DO statements
END
|
JavaScript:
while (condition) {
(action);
}
|
... statement1
#while (Inverted condition)
... statements
#end |
Postchecked Loop
"Repeat Loop"
REPEAT
statements
UNTIL (condition)
END |
JavaScript: "do-while"
do {
(action);
} while (condition);
|
With #for loop:(since POV-Ray 3.7 beta37)
#for (Variable, Start, End[, Step])
// step optional, default = 1
... statements
#end
With #while loop:
#local Nr = start value;
#local NrEnd = end value;
#local Step = stepsize;
#while (Nr < NrEnd +Step)
... statements
#local Nr = Nr + Step;
#end |
Count-controlled loop
"For Loop"
FOR (variable)=(start value) TO (end value)
STEP stepsize
DO statements
NEXT |
JavaScript:
for (init; test; continue)
(action);
|
With #for loop:(since POV-Ray 3.7 beta37)
#for (Identifier, Start, End[, Step])
// step optional, default = 1
#if(condition)
#break // terminate loop early
#end
... statements
#end With #while loop:
#local Identifier = start value;
#local End = end value;
#local Step = stepsize;
#while (Identifier < End +Step)
... statements
#if (condition)
#local Identifier = NrEnd
#end
#local Identifier = Identifier + Step;
#end |
Early exit from a for loop
"Early Exit Loop"
FOR (variable)=(start value) TO (end value)
STEP stepsize
DO statements
IF ( condition)
variable : = end value ;
END IF
NEXT |
JavaScript:
while (condition) {
if (condition)
break;
(action);
}
|