<< Prev        Next >>

ID : 5234

Scope of Variables

A variable refers to a temporary storage area for data used in a program. Global and local variables are available.

A global variable can be accessed by any programs (tasks) to share information between those programs. Global variable values are retained even after controller shutdown.

A local variable can only be accessed in a program where it is defined. Since local variables are restricted in access, they can be defined with a same name in different programs. Those variables do not affect each other. Values dissapear once a task completes.

If a numeric value "0" is assigned to a variable, the variable may be displayed as "-0", and also when the variable is converted to a character string, the result may be "-0".

ID : 5234

<< Prev        Next >>