POV-Ray : Newsgroups : povray.general : fundamental question re: #switch/#case/#break : Re: fundamental question re: #switch/#case/#break Server Time
29 Jul 2024 18:24:23 EDT (-0400)
  Re: fundamental question re: #switch/#case/#break  
From: "Jérôme M. Berger"
Date: 23 Nov 2010 14:08:06
Message: <4cec1116@news.povray.org>
Kenneth wrote:
> Jim Holsenback <jho### [at] povrayorg> wrote:
> 
>> If you're using 3.7betas (for some reason i think/thought you were)
>> there has been a change in behavior noted here:
>>
>> http://wiki.povray.org/content/Documentation:Tutorial_Section_1#Change
s_and_New_Features_Summary
>>
>> search for (browser find) break on that page, and the link will
>> eventually get you to the page you mentioned above. This is our MOST u
p
>> to date documentation as with regards to v3.7 ....
> 
> I'm still with 3.6.1c (but I assume that the *basic* operation of #case
/#break
> hasn't changed since then?)
> 
> If the link you mentioned is the latest WIKI documentation, it matches 
most of
> the wording in my 3.6.1 included documentation, and is the prime source
 of my
> puzzlement. Here's why:
> 
> The WIKI (updated 14 October 2010) at
> http://wiki.povray.org/content/Documentation:Reference_Section_2.5#The_
.23switch.2C_.23case.2C_.
> 23range_and_.23break_Directives
> 
> says, "if the [#case} clause's condition is true, that clause's tokens 
are
> parsed normally and parsing continues until a #break, #else or #end dir
ective is
> reached. If the condition is false, POV-Ray skips until another #case o
r #range
> is found."
> 
> and
> 
> "If a clause evaluates true but no #break is specified, the parsing wil
l fall
> through to the next #case or #range and that clause conditional is eval
uated."
> 
> The words 'skip' and 'evaluate' seem clear and co-consistent as to what
 *should*
> happen (*IF* I'm understanding them correctly.) Here's how I read the q
uoted
> statements in relation to the simple code example I posted:
> 
	You're right, there is a mistake in the doc. The first statement is
correct: if the condition is true, then parsing continues until a
#break, #else or #end (unless that #break, #else or #end is
associated with another control statement such as #if or #while).

	The second statement is wrong: when the parsing falls through to
the next #case or #range, that clause conditional is *ignored* and
the following statements are parsed as if the conditional were true.

	The problem here is with the word "conditional". The docs should
either contain a formulation similar to what I wrote above or use
the word "body" instead of "conditional".

		Jerome
-- 
mailto:jeb### [at] freefr
http://jeberger.free.fr
Jabber: jeb### [at] jabberfr


Post a reply to this message


Attachments:
Download 'us-ascii' (1 KB)

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