ASSIGN-AND-DECLARATION 1g 2024-03-15 laplante@plcb.ca GOWEB/Language

title: “ASSIGN-AND-DECLARATION” author: “laplante@plcb.ca” date: 2024-03-15 version: “1.0.1”

caegory: “GOWEB/Language”

ASSIGN-AND-DECLARATION

Description

Assignment is used to put a value into a variable.

A variable is defined using the following BNF:

ID              [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*

A variable must already be defined before assigning to it.

To declare a variable, use:

ID := value;

If you use:

const id := expression;

then this identifier is defined globally and is read-only.

If this identifier is defined in a package, it can be accessed with package_id::id.

If you want to declare a global variable, you can use the following:

global id := expression;

If you want to use a global variable inside a function, you must declare it using:

global id;

Examples

a := 5;
a;
a = 6;
a;

return

56

See also

Version