Is zero the same as empty?

J. Landman Gay jacque at hyperactivesw.com
Mon Oct 27 15:15:19 EDT 2014


On 10/27/2014, 1:55 PM, dunbarx at aol.com wrote:
> on mouseUp
>    local b
>    answer b + 1
> end mouseUp
>
>
> Also works just fine, thank you, and therefore the engine still knows what to do

Right, because even if you put empty into the variable first (as in your 
second message) the act of doing a math calculation forces the variable 
to zero. It happens internally, so you don't see it.

put empty into b
put b = zero -- false
put b+1 -- 1, because empty has converted to zero internally
put b = zero -- false

The point being that until it is used, empty can be either empty or 
zero. Usage determines the value. However, the last line above will put 
"false", because the engine restores the original value if it was specified.

This throws an error:

on mouseUp
   put b = zero -- false
   put b = "" -- false
   put b+1 -- ERROR
end mouseUp

So we can apparently confuse the engine into not knowing what the value 
should be.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list