### 4.29.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
      ==>

User manual for Singular version 4.4.1, 2025, generated by texi2html.