Simple Branching
#if-statement
(If ... then ... else ...) |
Multible Branching
#switch-statement
(Branching by different switch values) |
Syntax in POV-Ray:
#if (Condition)
... statements1
#else // (optional)
... statements2
#end
|
Syntax in POV-Ray:
#switch (Switch_Variable)
#case (Switch_Value1)
... statements
#break
#case (Switch_Value2)
... statements
#break
#range (Switch_Value_Start,Switch_Value_End)
... statements
#break
#else // (optional)
... statements
#break
#end // end of #switch |
Equivalent structures in other programming languages:
|
IF <condition>
THEN
<actions>
ELSE
<alternative actions>
ENDIF
|
SWITCH (someChar) {
CASE 'a': <actionOn "a">;
BREAK;
CASE 'x': <actionOn "x">;
BREAK;
CASE 'y':
CASE 'z': <actionOn "y"and"z">;
BREAK;
DEFAULT: <actionOnNoMatch>;
} |
JavaScript:
if (condition) {
(action) ;
}
if (condition) {
(actionOnCondition) ;
} else {
(actionOtherwise) ;
return;
} |
JavaScript:
switch (variable) {
case "1":
(actionOn1);
break;
case "2":
(actionOn2);
break;
default:
(actionOnDefault);
break;
} |