POV-Ray : Newsgroups : povray.bugreports : problem with '#break' in macro : Re: problem with '#break' in macro Server Time
20 Apr 2024 05:14:41 EDT (-0400)
  Re: problem with '#break' in macro  
From: Kenneth
Date: 10 Sep 2021 11:30:00
Message: <web.613b793cd2ea10ff4cef624e6e066e29@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
>
> [source code snippet]
> The code above works with the code variations recently posted. However,
> it's admittedly a slap shot. More thought and testing needed.
>
> My quick test as to whether on the right track was to create a scene
> file like jr's original, but with macro internals looking like:
>
>    #if (f_)
>      #debug "ok.\n"
>    #else
>      #debug "break.\n"
>      #break
>    #end
>
> The variation above works for me in all v3.7+ versions I have in hand.
>

Just discovered that the following also produces the error and fails-- unless
the #debug is there. Seems that in this case, the inner #end actually *needs*
something to follow it! I tried adding #break and/or #end here and there
(guesswork!) to try and MAKE it work without the #debug, but no luck so far.

#declare R = seed(4711);
#for (I, 1, 100)
  #if (rand(R) < 1.1) // always less than 1.1
     #break // terminate loop early
  #else
  #end
  // #debug concat(str(I,0,0), " iterations and counting\n")
#end


Post a reply to this message

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