Testing for numerics

Ken Ray kray at sonsothunder.com
Sun Oct 8 13:27:24 EDT 2006


On 10/5/06 8:56 PM, "J. Landman Gay" <jacque at hyperactivesw.com> wrote:

> Robert Sneidar wrote:
>> The benefit would be that I could use the state of the global to
>> determine if this was the first time it had been initialized and run
>> some setup code. The natural state of certain globals is empty, so I
>> couldn't simply test for that. If I were coding from scratch I would
>> just work around this, but I am porting business logic from another dev
>> environment. They use this extensively.
>> 
> 
> Maybe you could fudge it by initializing all the globals to the string
> "NULL". Then check for that. Then you'd just have to add quotation marks
> around all the "NULL"s in the existing code.

Actually, since the null value is supported, and since you can't initialize
a global with a value anyway (can't do "global myGlob = 4"), you'd have to
assign a value anyway, so why not null:

    global gMyGlob
    put null into gMyGlob

Anyway, that's my 2 cents,

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




More information about the use-livecode mailing list