One should remember that this evaluates both parameter options.  For constants, 
this is not a problem but for terminating recursive functions, it can be fatal. 
 The debugDo version might not be worth the work, but might be fun to talk 
about.

I often use 'get' in 'if', keeping the whole 'if' as simple as possible in 
situations like this.  Sometimes, when it clarifies, I use a function that 
includes just the boolean as a parameter if the needed data is all script 
local.  

Dar


On Jul 17, 2012, at 5:32 PM, Dick Kriesel wrote:

> Hi, Pete.  You can wrap your "if" in a function, so any caller can have just 
> one line.
> 
> myCommand parm1,iff(<condition>,<parm2a>,<parm2b>),parm3
> 
> function iff pBoolean,pTrueValue,pFalseValue
>   if pBoolean then
>      return pTrueValue
>   else
>      return pFalseValue
>   end if
> end iff
> 
> -- Dick
> 
> 
> On Jul 17, 2012, at 4:18 PM, Peter Haworth wrote:
> 
>> I'm pretty sure this is not possible but it would be very cool if a
>> parameter to a command could be a conditiion something like:
>> 
>> myCommand parm1,if <condition> then <parm2a> else <parm2b>,parm3
>> 
>> I've tried every which way to do that but always get compile errors.
>> 
>> Not possible, right?
>> 
>> Pete
>> lcSQL Software <http://www.lcsql.com>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to