Problem with zeros in lookup table

Ken Ray kray at sonsothunder.com
Wed Nov 22 21:18:27 EST 2006


On 11/22/06 8:08 PM, "Mark Smith" <mark at maseurope.net> wrote:

> I don't know what a stanine score is, or how you're organizing your
> scores, but you might want to put code in to check whether or not the
> raw score is empty, zero or whatever. Sometimes in Revolution you can
> include an empty variable in a numerical calculation and still get a
> numerical result, rather than an error.

That's a good point. Many times I need to check if a variable is empty or 0
and take the same action. One *could* write it this way:

  if (tVar = 0) or (tVar = "") then

but another (shorter way) is:

  if (tVar + 0) = 0 then

This way, if tVar is 0 or empty, it ends up becoming 0 (empty + 0 = 0).

Ken Ray
Sons of Thunder Software, Inc.
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com





More information about the use-livecode mailing list