Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
    Conditional Statements -
Deutsch Deutsch

Home
- POV-Ray Tutorial

  - Conditional
    Statements

  Branching
  #if(...) ... #else ... #end
    - in loops
    - in macros
    - in animations
    - turning on/off of parts
  #switch(...) #case(..) ...
         #range(..) ... #end
    - selection by tables

  Check for Existence
   > #ifdef(...) #ifndef(...)
    - Check in include files
    - Defaults in include files

  Loops
 Prechecked, Postchecked,
 Count-controlled, Early-Exit
    #while(...)... #end
    #for(...)... #end
    - Samples:
    - Loops with POV-Ray
    - Loops, Sine, Cosine
    - Random with POV-Ray
                                       

Branching by Check for Existance

In the scenery description language (SDL) of POV-Ray there are structures, which allow us to realizise conditional statements depending on weather a variable is declared or not:


Syntax in POV-Ray:
 
#ifdef (Variable)
 ... statement
#else // (optional)
 ... statement2
#end 
Checks if a variable is declared.
This declaration can be done
global by "#declare" as well as also
local by "#local" .
#ifndef (Variable)
 ... statement
#else // (optional)
 ... statement2
#end 
Checks if a variable is not declared
#undef (Variable)
Destroys a former declared variable.
If there exist multiple local declared vrsions of a variable, the most recent and most local one will be destroyed (deleted), all variables with the same name at higher levels (declared by "#declare" or "#local") will still exist.

top

© Friedrich A. Lohmüller, 2010
homepage:www.f-lohmueller.de