Value(0) and value("0") evaluate to 0.
VOID is considered 0 for evaluation purposes.
Generally in programming, a null or void pointer is all 0's, and Director
continues with that in Lingo.
So, this can be very convenient actually, particularly for evaluating
parameters that weren't passed in. For instance:
on myFunction skipCompatibilityTest
-- Unless turned off, first check if they're compatible
if (not skipCompatibilityTest) then
runCompatTest()
end if
-- do other things
end
Now there are some who will argue from a purity standpoint against this
(probably insisting on OOP practices to boot, nothing against them), but
for practical everyday programming, it's pretty darn handy. If the user
just called the function without passing anything in, that's effectively
the same as having a default of FALSE.
- Tab
At 01:02 PM 9/20/00 -0700, Kerry Thompson wrote:
>Now wait a minute. 0 and VOID are *not* the same--at least they shouldn't be.
>
>But I ran into a little bug, and what it boils down to is this:
>
>
>put value(0)
>-- 0
>
>if value(0) = VOID then put "Void"
>-- "Void"
>
>Works the same for a string, too (value("0")).
>
>Is this normal Lingo behavior?
>
>
>Cordially,
>Kerry Thompson
>Learning Network
>
>
>[To remove yourself from this list, or to change to digest mode, go to
>http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
>email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
>Lingo-L is for learning and helping with programming Lingo. Thanks!]
>
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]