Difference between revisions of "LSL Variables"
Gigs Taggart (talk | contribs) (fact check) |
(added see-also links to variable types) |
||
Line 14: | Line 14: | ||
</pre> | </pre> | ||
== | == Scope of variables == | ||
The variable name is in scope from the point it first appears to the end of the scope it is in, or the end of the script for global variables. A name may not be defined twice in the same scope, but a name may be redefined in an inner scope, and it hides the same name at outer scope. Again, the semantics are very similar to C and Java. | The variable name is in scope from the point it first appears to the end of the scope it is in, or the end of the script for global variables. A name may not be defined twice in the same scope, but a name may be redefined in an inner scope, and it hides the same name at outer scope. Again, the semantics are very similar to C and Java. | ||
== See Also == | |||
* [[string]] | |||
* [[key]] | |||
* [[integer]] | |||
* [[float]] | |||
* [[list]] | |||
* [[vector]] | |||
* [[rotation]] |
Revision as of 12:14, 20 February 2007
A variable is a place to store information, like a number or a string.
A variable has a name, a type, and a value. The name starts with a letter, and the name convention is similar to C or Java. Case matters. X is not the same as x.
LSL is a strongly and statically typed language. This means that variables must be declared by type and that variables may only hold values of a corresponding type.
Some examples:
<lsl> integer l; float x = 1.2; string n = "Lee"; </lsl>
Scope of variables
The variable name is in scope from the point it first appears to the end of the scope it is in, or the end of the script for global variables. A name may not be defined twice in the same scope, but a name may be redefined in an inner scope, and it hides the same name at outer scope. Again, the semantics are very similar to C and Java.