Table of Contents

ugBASIC User Manual

local task variable operator ✓

SYNTAX

   = [variable]
   [variable] = expression
   = [variable$]
   [variable$] = expression

PURPOSE

To guarantee the use of local variables within parallel procedures, since the procedure does not have a stack, it is necessary to prepare an array to contain this type of information. Therefore, using the array access operator, it is then possible to access the individual variables, using the task identifier as an index.

ugBASIC provides a compact form to indicate this type of access. Instead of writing v(THREAD) you can write [v]. This operator, called the “local task variable operator”, can be used anywhere, and in any expression, and can be used as the target of the variable.

In accessing the array, as in any other variable, the dollar sign ($) can be juxtaposed to indicate that you want to access a variable of type string. In this case, a further type check will be carried out during the compilation, to avoid referring to a variable of numerical type.

EXAMPLE

  PUT IMAGE token AT [x],[y]
  [x] = [x] + 1
  PRINT [word$]
  [word$] = "ok!"

See also the following example files:

AVAILABLE ON

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY