POV-Ray : Newsgroups : povray.general : Nested #switch...#end blocks - strange behaviour! : Nested #switch...#end blocks - strange behaviour! Server Time
1 Aug 2024 02:14:17 EDT (-0400)
  Nested #switch...#end blocks - strange behaviour!  
From: Jörg 'Yadgar' Bleimann
Date: 15 May 2006 18:55:49
Message: <446906f5$1@news.povray.org>
High!

To differentiate multiple camera views according to the clock variable, 
I set up a logical structure consisting of nested #switch...#end blocks 
- only two levels deep, but a strange effect always occurred: when the 
inner #switch block is reached, only either the first or the last 
alternative is chosen, but not the ones in between. With this test 
script, this means if I start with +k1.1 or +k1.2, I always only got 
"One point ????" as #warning output... and, strangely, obviously line 2 
is interpreted correctly (see output in line 4)! Is this a bug actually?


#declare clock1 = int(clock);
#declare clock2 = mod(clock*10, 10);

#warning concat("clock2 = ", str(clock2, 1, 0))

#switch(clock1)
   #case (0)
     #warning "Zero!"
   #break
   #case (1)
     #switch(clock2)
       #case (0)
         #warning "One point zero!"
       #break
       #case (1)
         #warning "One point one!"
       #break
       #case (2)
         #warning "One point two!"
       #break
       #else
         #warning "One point ????"
     #end
   #break
   #case (2)
     #warning "Two!"
   #break
   #case (3)
     #warning "Three!"
   #break
   #else
     #warning "Oops..."
#end

See you in Khyberspace!

Yadgar


Post a reply to this message

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