Hard code or portable code
Dar Scott
dsc at swcp.com
Wed Mar 10 19:42:27 EST 2004
On Wednesday, March 10, 2004, at 05:30 PM, hershrev wrote:
>> function double x
>> return x*2
>> end double
>>
>> on mouseUp
>> put 1 into x
>> put 2 into y
>> put double(3) + double(x) + double(y+1)
>> end mouseUp
> What should the result be on this ?
>> ==>
>> 14
14
(Sorry about the cute notation.)
The double(3) would evaluate to 6.
The double(x) would take the local x in mouseUp (mouseUp can't see the
one in double) and have that doubled. That would evaluate to 2.
The double(y+1) would evaluate to the same as double(2+1) or double(3)
or 6.
And 6 + 2 + 6 evaluates to 14.
Dar Scott
More information about the use-livecode
mailing list