POV-Ray : Newsgroups : povray.general : fundamental question re: #switch/#case/#break : Re: fundamental question re: #switch/#case/#break Server Time
30 Jul 2024 00:23:11 EDT (-0400)
  Re: fundamental question re: #switch/#case/#break  
From: Kenneth
Date: 23 Nov 2010 21:10:00
Message: <web.4cec72e72f7b65a8196b08580@news.povray.org>
fin### [at] head-cfaharvardedu (Thomas A. Fine) wrote:

> Simplest way to look at it - successive cases with no break are all
> OR'ed together.
>
> "case" means "If this case OR any of the preceding cases in this block
> since the last break are true, execute this code"
>
> This lets you conserve code by grouping a bunch of different cases
> together.  See the "N is prime" example from clipka.  But you could
> also ADD code for #case(2) that only executes for that, without
> separating it out of the conditions for 3,5 and 7:

That is a beautiful and clear description (and code example) of how it all
works--MANY thanks! (It's also a great little piece of experimental code for me
--I've been playing around with it, to get a clearly-understandable 'feel' for
what goes on.) And it shows me that I sure had a muddled *quasi*-understanding
of it all, before now. Geez, I sure was clueless...

IMO, your comments and code example would make a great addition to the WIKI
(hint, hint!)

Ken


Post a reply to this message

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