POV-Ray : Newsgroups : povray.bugreports : problem with '#break' in macro : Re: problem with '#break' in macro Server Time
24 Oct 2021 09:33:01 EDT (-0400)
  Re: problem with '#break' in macro  
From: Kenneth
Date: 10 Sep 2021 06:15:00
Message: <web.613b2efed2ea10ff4cef624e6e066e29@news.povray.org>
This is more strange than I thought.

Compare these two #for-loop examples. The first is my modified version-- fatal
error; the 2nd is almost identical to the doc's example, which *does* at least
parse OK. The only difference is where the #debug(...) is placed. The 1st
version is kind of like your #macro, with the inner #else actually being used
for something; the 2nd makes no use of the #else, and successfully parses. I
have no idea as to why there should be a difference.

// [doc's version, slightly modified]
#local R = seed(4711);
#for (I, 1, 100)
  #if (rand(R) < 1.1) // always less than 1.1
       #break // terminate loop early
  #else
       #debug concat(str(I,0,0), " iterations and counting\n")
  #end
#end


// [doc's version, almost as-is]
#local R = seed(4711);
#for (I, 1, 100)
  #if (rand(R) < 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-2021 Persistence of Vision Raytracer Pty. Ltd.