nested ifs

simplsol at aol.com simplsol at aol.com
Wed Jan 25 09:54:56 EST 2006


Chipp,
I have the same experience with nested conditionals. I have found the 
following format (with the "then" below the "if") helps.

if tResult is "Error"
then
  answer "Go Ahead anyway" with "Cancel" or "OK"
  if it is "Cancel" then exit to top
end if

There is sometimes still a problem, especially if the nested 
conditional contains an "else" - so I always close these with an "end 
if":

if tResult is "Error"
then
  answer "Go Ahead anyway" with "Cancel" or "OK"
  if it is "Cancel"
  then
      exit to top
  else
      doElseStuff
  end if
end if

It takes more space but I find it is easier to read - and it always 
compiles.
Paul Looney

-----Original Message-----
From: Chipp Walters <chipp at chipp.com>
To: Use-Revolution <use-revolution at lists.runrev.com>
Sent: Wed, 25 Jan 2006 04:32:53 -0600
Subject: nested ifs

   I like to do the following: 
 
 if tResult is "Error" then 
   answer "Go Ahead anyway" with "Cancel" or "OK" 
   if it is "Cancel" then exit to top 
 end if 
 
  Most of the time it compiles, but sometimes the single line if 
statement in the middle throws and error and won't compile, so I'm 
forced to do: 
 
 if tResult is "Error" then 
   answer "Go Ahead anyway" with "Cancel" or "OK" 
   if it is "Cancel" then 
   exit to top 
   end if 
 end if 
 
  Anyone know why the compiler does this? I can't seem to figure out 
under what circumstances this seems to happen. 
 
 best, 
 
 Chipp 
 
 _______________________________________________ 
 use-revolution mailing list 
 use-revolution at lists.runrev.com 
  Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences: 
 http://lists.runrev.com/mailman/listinfo/use-revolution 

    



More information about the use-livecode mailing list