POV-Ray : Newsgroups : povray.advanced-users : problem using ORs and strcmp() in #switch/#case : Re: problem using ORs and strcmp() in #switch/#case Server Time
24 Apr 2024 09:55:36 EDT (-0400)
  Re: problem using ORs and strcmp() in #switch/#case  
From: Bald Eagle
Date: 7 Nov 2017 15:10:00
Message: <web.5a0212f11346e9e0c437ac910@news.povray.org>
I've only briefly looked this over, but it seems to me that you've misunderstood
how the switch-case/range-break-end block works.


You define #switch (trigger) - which uses a variable value "trigger" for the
rest of the case/range block to operate on.

Then every case () or range () directive is set up to operate on a specific
value of "trigger" or range of "trigger" values.
#break directives end each sub-block.
Then there's a catch-all else, then the end.

So,

#declare Clock = clock;

#switch (Clock)

#case (0.1)
#debug "The clock is at 0.1 \n"
#break

#case (0.2)
#debug "The clock is at 0.2 \n"
#break

#case (0.3)
#debug "The clock is at 0.3 \n"
#break

#case (0.4)
#debug "The clock is at 0.4 \n"
#break

#case (0.5)
#debug "The clock is at 0.5 \n"
#break

#else
#debug "The clock is over 0.5... \n"

#end


Post a reply to this message

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