A code style question

Peter Haworth pete at lcsql.com
Tue Jan 20 11:45:23 EST 2015


I'd go with the first one. The second one makes my eyes glaze over! Plus I
think there should be an else before the second if in the second function.

I might consider something like this.

function baseID newID
   if newID is empty then
      baseID_newIDempty
   else
      baseID_newIDnotempty
   end if
   Return the baseID of this stack
end baseID

The two subsidiary handlers would have the logic from your first function
for empty/not empty.

Pete
lcSQL Software
It would be good to post code that works:

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
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list