switch case question

Martin Baxter mb.userev at harbourhosting.co.uk
Sat Oct 21 17:53:00 EDT 2006


Mark Swindell wrote:
> I have a global variable gTimedTest
> 
> Depending on whether it is empty or not I want to do different things in 
> a handler
> 
> How do I write this to make it happen with a switch control structure?
> 
> switch gTimedTest
> 
> case empty
> stuff
> break
> 
> case not empty
> other stuff
> break
> 
> end switch
> 
> The above doesn't work... what is the proper syntax or approach?
> 
> Thanks for your help,
> Mark

You could do:

switch gTimedTest
case empty
  stuff
  break
default
  other stuff
  break
end switch

or

put gtimedtest is empty into isempty
switch isempty
  case true
   stuff
   break
  case false
   other stuff
   break
end switch

Martin Baxter




More information about the Use-livecode mailing list