Zero/empty
Peter Haworth
pete at lcsql.com
Tue Sep 11 14:35:05 EDT 2012
I think you nailed it Mike. I simplified my post a bit. I'm actually
testing a parameter to a function not a variable and the call to the
function does not pass the parameter. In other words:
put myFunction(p1) into whatever
function myFunction p1,p2
if p2 is not zero…..
end myFunction
This reminds me of the days when "unitialised variable" was the source of
many a happy hour of debugging! Hadn't come across the need to initialise
variables in LC but this looks like one.
Pete
lcSQL Software <http://www.lcsql.com>
On Tue, Sep 11, 2012 at 10:56 AM, Mike Bonner <bonnmike at gmail.com> wrote:
> There are some quirks I found on testing this.
>
> This evaluates to false
>
> local tvar
>
> --put empty into tvar
>
> put (tvar is not zero)
>
>
>
> This evaluates to true
>
> local tvar
>
> put empty into tvar
>
> put (tvar is not zero)
>
>
> So it seems a declared var that has had nothing done to it sees itself as
> empty and zero. If you put empty into it, then it is not zero. Cool huh?
>
> On Tue, Sep 11, 2012 at 11:47 AM, Peter Haworth <pete at lcsql.com> wrote:
>
> > Just ran across a little oddity. The statement "if tVar is not zero"
> > evaluates to false if tVar is empty. Apparently empty and zero are
> treated
> > the same for comparison purposes?
> > Pete
> > lcSQL Software <http://www.lcsql.com>
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list