Carapace

Variables

There are two kinds of variables in Carapace script:

Local Variables

Local variables are only visible within the function or method in which it is defined.

A local variable, along with its class, is declared using the local keyword.

The name of a local variable must start with a letter (upper or lower case) or an underscore _. Subsequent characters in a variable name can be letters, digits or underscores.

Global Variables

A global variable is visible to any function or method invocation within the same thread.

A global variable, along with its class, is declared by the keyword global.

The name of a global variable must start with two colons ::. The rest of the name is as for a local variable.

To ensure the value of a global variable is copied into child threads, see the function export.


Contents Index Current topic: objects Related topics: functions