Newbie question - how to check for a varible
J. Landman Gay
jacque at hyperactivesw.com
Sat May 9 12:57:07 EDT 2009
Stephen Cox wrote:
> Wait. I don't get this. You saying that checking if an unused variable is
> empty returns false? Does revolution put some data in a variable when
> created?
Sort of, but only in specific cases, which is mostly a side-effect of
how friendly Rev's interpreter is and how it deals with strings. (The
discussion about quoted field names shows how flexible Rev is with
strings.) If a variable is not specifically created with a value, the
value of the variable is the variable's name itself.
This creates a variable without assigning it any value:
on mouseup
put (var = empty) && "Var = " & var
end mouseup
You get: false var = var
But this assigns a value and gives what you'd expect:
on mouseUp
put empty into var
put (var = empty) && "Var = " & var
end mouseUp
Gives: true var =
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list