Newbie question - how to check for a varible
Stephen Cox
stephen at networkxfla.com
Sat May 9 14:15:01 EDT 2009
By the way, off topic a bit:
Wouldn't "I" && "am" be the same as "I " & "am"? ((notice the space after
"I" in the second example")).
On 5/9/09 12:57 PM, "J. Landman Gay" <jacque at hyperactivesw.com> wrote:
> 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 =
More information about the use-livecode
mailing list