MC-Basic:DIM SHARED ... AS LONG or DOUBLE or STRING or STRING OF UTF8

From SoftMC-Wiki
Revision as of 09:14, 22 May 2014 by Miborich (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This command is used to define a task variable. Task variables are defined within a task, and may be used only within that task.

A variable being defined may be scalar or array. An array may be defined with up to 10 dimensions. The length of a string variable practically is not limited (limited by the amount of free memory space).

A task variable may have the same name as a system variable. Within the task, a reference to the variable name will reference the task variable and not the system variable.

The value of a task variable may be queried from the terminal using the Watch mechanism.

Syntax

Dim Shared <variable> As Long | Double | String | String of UTF8

Availability

All versions. Declaration of UTF-8 strings is available since Version 4.5.10.

Scope

Task

Limitations

Write only. Task variables must be defined before the start of the task itself (before the Program keyword).

Examples

Dim Shared Var1 as long                                         ‘Integer

Dim Shared MyArray[4][5] as long                          ‘Long array

Program                                                                  ‘Start of task
       <code>
End Program                                                           ‘End of task

See Also