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
29 Apr 2024 09:49:58 EDT (-0400)
  Re: problem using ORs and strcmp() in #switch/#case  
From: clipka
Date: 8 Nov 2017 07:58:22
Message: <5a02ff6e$1@news.povray.org>
Am 08.11.2017 um 12:28 schrieb Bald Eagle:

> I think you're stuck thinking about #switch() and #case() as some sort of
> semi-Boolean operator, when it's more of a "pick this value from the following
> list" function.  Maybe if you think about the whole block like an array [n] and
> the #case statements are picking a specific array item (sort of).

I would pick the analogy of a `#if...#elseif...#end` construct:

    #switch(VALUE)
      #case(COMPARE1)
        // branch 1
      #break
      #case(COMPARE2)
        // branch 2
      #break
      ...
      #default
        // branch Z
      #break
    #end

is fully equivalent (presuming all values are numeric) to:

    #if(VALUE=COMPARE1)
      // branch 1
    #elseif(VALUE=COMPARE2)
      // branch 2
    ...
    #else
      // branch Z
    #end


Post a reply to this message

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