{{htmlmetatags>metatag-robots=()
metatag-title=(local task variable operator | ugBASIC User Manual)
metatag-keywords=(ugBASIC,Commodore 64,Commodore PLUS/4,ZX Spectrum)
metatag-description=(Manual page for local task variable operator)
metatag-media-og:image=(:ugbasic:logo-ugbasic-fb.png)
metatag-og:title=(local task variable operator | ugBASIC User Manual)
metatag-og:description=(Manual page for local task variable operator)
}}
====== 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:
* ''[[https://github.com/spotlessmind1975/ugbasic/tree/main/examples/multitasking_example_06.bas|multitasking_example_06.bas]]''
==== AVAILABLE ON ====
*
* Atari (400/800)
* Atari XL/XE
* Commodore 128 (MOS 8502)
* Commodore 128 (Zilog Z80)
* Commodore 64
* Commodore 64+REU
* TRS-80 Color Computer
* TRS-80 Color Computer 3
* ColecoVision
* Amstrad CPC 664
* Dragon 32
* Dragon 64
* Thomson MO5
* Thomson MO5
* Olivetti Prodest PC128
* Commodore PLUS/4
* SEGA SC-3000
* SEGA SG-1000
*
* VG-5000
* Commodore VIC-20
* ZX Spectrum 48
==== ANY PROBLEM? ====
If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please [[https://github.com/spotlessmind1975/ugbasic/issues/new?title=ISSUE ON local task variable operator|open an issue]] for this keyword on GitHub. Thank you!===== POWERED BY =====
[[:ugbasic:user:index|{{ :ugbasic:user:logo-ugbasic.png?nolink&600 |}}]]