|
|
> I know what ifdef does (the example below shows me using it)...
>
> //#declare text2use = 2;
>
> box {
> <-10,0,11>,<10,10,10>
>
> #ifdef(text2use)
> texture { pigment { White } }
> #else
> texture { pigment { Green } }
> #end
>
> }
>
> .... but I'm struggling to understand when you would use it. Why would you refer
> to a variable you've not defined? Isn't that just sloppy coding.
>
> Has anyone got/had a real-use case for this command? I'd love to know what I'm
> missing out on.
>
>
It's often used in includes. Some uses are:
Make sure that you don't re-parse a file that's been included before.
Take a look at the base includes, they all have this construct:
#ifndef(Include_File_Flag)
#declare Include_File_Flag=version;
...body of the include file goes here...
#end
Have some defaults parameters that you can optionaly define before
calling an include or a macro.
Alain
Post a reply to this message
|
|