UIEvolutin Inc.
UJML Language Reference
Variables Explained

This is a simplified explanation of variables.

A variable is a place in the device memory where some data is stored and made available to your application. Your application can find that data and ascertain what kind of data it is. See Data Types. In your application, you refer to this data by the name you gave it when you declared the variable. See Identifiers.

Variable names and scope

Naming and using a variable is not quite as simple as labeling a file folder. First the name must meet certain minimum requirements or it will cause a compilation error. See Identifiers

Secondly, variable names have 'scope', meaning that a variable is only available in the section of your code in which the variable is defined. See Data Scoping and Sharing. When a variable goes out of scope, the program can no longer access its data. A variable is in scope in the section that defines it and in sections contained by that section, unless the child section defines a different variable with the same name.

How the data is stored

Data is stored in two different ways. Primitive data types like booleans and integers are stored 'by value', meaning that the variable contains the actual value. More complex data types like strings and arrays are stored 'by reference', meaning that the variable contains a reference to a series of values somewhere else in memory. See Arrays.

How a variable is used

Variables can be passed to functions as arguments. See Using Functions. You can assign their value from a literal or another variable of a compatible data type. See Literals and Constants. You can use them in an expression. See Script Expressions. In other words, you can use a variable anywhere that you can use a literal value.

Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
What do you think about this topic? Send feedback!