Game Development Community

What's the difference between $ or %?

by Aaron Varshney · in Torque Game Builder · 04/15/2005 (4:27 pm) · 3 replies

I've actually wanted to know this, in some places I see $ and others I see %, I always use $ of which I don't see any difference, is there a need for a % at all or is it used to allow the use of two variables with the same name?
Just curiosity, and curiosity killed the cat. :p

#1
04/15/2005 (4:33 pm)
$test

is a global variable and can be references anywhere in the script

%test

is a local variable that can only be referenced in the scope of a single function, it then is destroyed... be careful not to use these in the console, considering the scope in the console is each command :)
#2
04/15/2005 (4:56 pm)
Aaaah so that's how it is, that helps a lot actually, cheers for that.
#3
04/15/2005 (5:00 pm)
Here is a good place to get some good info... the F.A.Q. has some questions like those... about 48 of them (though its been a while since I've updated)...

and a good collection of tutorials to get started(if needed) :)