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

From SoftMC-Wiki
Jump to: navigation, search
Language: English  • 中文(简体)‎

This command is used to define a system variable. System variables are defined either in the configuration file (CONFIG.PRG) or from the terminal. These variables have system-wide visibility. This means they may be used at the terminal and in tasks. All tasks may use the variables and the variables may be used to coordinate activities among tasks.

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 is only limited by the amount of free memory space.

Variables may be one of three types. A Long type indicates that the variable is a 32-bit signed integer, Double indicates that it is double precision floating point, String indicates that the string is composed of ASCII-8 characters and String of UTF8 indicates that the string is encoded according UTF-8 rules.

Syntax

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

Availability

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

Type

Long, Double, or String

Scope

Configuration  Terminal or Task ( before Program … End Program block )

Since Version 4.5.17 the global (common shared ) declaration is also possible from the Library context.

Limitations

Write only. When used in the Configuration file, the declaration must come before the Program keyword.

Examples

Common Shared Var1 as long                                 ‘Integer variable

Common Shared Var2 as double                             ‘Double precision variable

Common Shared Var3 as string                                ‘String variable

Common Shared MyArray[4][5] as long                  ‘Integer array

See Also