A code style question

Geoff Canyon gcanyon at gmail.com
Tue Jan 20 09:42:23 EST 2015


I think these two functions are equivalent. Which would you use? (or would
you use a different function altogether?)

function baseID newID
   if newID is empty then
      if not exists (the baseID of this stack) then
         set the baseID of this stack to "this card"
      end if
   else
      if exists newID then
         set the baseID of this stack to newID
      else
         set the baseID of this stack to "this card"
      end if
   end if
   return the baseID of this stack
end baseID

function baseID newID
   if (newID is not empty and not exists newID) or \
         (newID is empty and not exists (the baseID of this stack)) then \
         set the baseID of this stack to "this card"
   if newID is not empty then set the baseID of this stack to newID
   return the baseID of this stack
end baseID



More information about the use-livecode mailing list