POV-Ray : Newsgroups : povray.general : What use is ifdef ? : Re: What use is ifdef ? Server Time
6 Oct 2024 09:57:35 EDT (-0400)
  Re: What use is ifdef ?  
From: FNH
Date: 3 Mar 2014 13:05:01
Message: <web.5314c4368b4b40c85f52a9c30@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 03/03/2014 18:49, FNH nous fit lire :
> > 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.
> >
> >
>
> you can define variable in code, but also in command line.
>
> the most traditional use is the classical protection of include file: if
> the value already exist, skip the definition.

Excellent, I'll have try using as a command line switch. Thanks :)


Post a reply to this message

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