Printing Crashes Rev in OSX

Frank Leahy frank at backtalk.com
Fri Feb 4 03:47:10 CST 2005


(I know others will chime in too, but...) If there's no "break" 
statement, Transcript falls through until it either finds one, or the 
end of the switch statement is reached.

switch (foo)
  case "a"
     do_a
   case "b"
     do_b
   case "c"
     do_c
     break
   case "d"
     do_d
end switch

if foo = "a", then RunRev will execute do_a, do_b and do_c.  It then 
hits the "break" statement in case "c" and falls out of the switch.

So in your case, the print case was true, it executed the print lines, 
you didn't have a "break" statement so it continued executing.  It 
ignored the quit case, and executed the quit statements.

Does that help?

-- Frank

Web Photos Pro: Software for Photo Bloggers and Other Photo Power Users
See us on the web at http://www.webphotospro.com/

On Feb 4, 2005, at 4:59 AM, use-revolution-request at lists.runrev.com 
wrote:

> From: Sivakatirswami <katir at hindu.org>
> Subject: Re: Printing Crashes Rev in OSX
> To: use-revolution at lists.runrev.com
> Message-ID: <C1FF069E-7655-11D9-B49A-000A959D0AC6 at hindu.org>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
>
> On Feb 3, 2005, at 2:37 PM, Robert Brenstein wrote:
>
>> Sounds like the above scripts do what they are supposed to do. In both
>> cases, if the pWhichItem is quit, only the quit part executes.
>> However, if pWhichItem is print, the former script will do the
>> printing but because there is no break (meaning escape out of the
>> switch clause), it continues with functions under the quit case.
>>
>> In the latter case, you do not actually need break at the very end
>> unless it s followed by the default case.
>>
>> Robert
>
>
>
> That still seems illogical..  "a boolean is a boolean is a boolean"
>
> case "Quit" must evaluate to "false"
> if the menuPick parameter was "Print"
>
> Why would it then still execute the Quit statements?
>
> I'm probably not understanding how Switch and Case actually work..
>
> Sivakatirswami



More information about the use-livecode mailing list