Home Online Manual
Top
Back: reference expressions
Forward: shared expressions
FastBack: pyobject
FastForward: Functions and system variables
Up: countedref
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

4.27.3 shared declarations

Syntax:
shared name = expression ;

Purpose:
defines a shared object.

Default:
None

Example:
 
system("reference"); system("shared");
  shared empty;
  empty;
==> `_`
==> 

  shared str = "Hello World!";
  str;
==> Hello World!
==> 
  shared ll= list(4, 5, 6);
  ll;
==> [1]:
==>    4
==> [2]:
==>    5
==> [3]:
==>    6
==> 
  ll[2] = str;  // change list element
  ll;
==> [1]:
==>    4
==> [2]:
==>    Hello World!
==> [3]:
==>    6
==>