Declaring Variables

Jan Schenkel janschenkel at
Mon Nov 27 16:35:57 EST 2006

--- LunchnMeets at wrote:
> Hi,
> I've seen references to declaring or initializing
> variables. How and why 
> would I do that?
> Joe

Hi Joe,

Globval and script-local variables need to be
declared, or you can't use them as such - the compiler
will assume you're working with a temporary variable
by the same name, and may even decide that the default
value of that variable is the same as the name of the
Declaring all your variables is good practice and
helps you write software with less bugs: when you turn
on 'variable checking' the compiler will not accept a
script where any variable hasn't been previously
Some people feel it gets in the way of their scripting
style, and that's why it's nice to have it as an
option rather than rigorously enforced by the
Personally, I don't declare temporary variables in
one-off scripts, but I do declare them in libraries
and production software. I'm sure I'm not the only Rev
user who has discovered and consequently fixed bugs
that way before sending the software out the door.

Just my two cents,

Jan Schenkel.

Quartam Reports for Revolution

"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.

More information about the Use-livecode mailing list