- DocumentID: set
  Title: >+
    `set`
  CategoryID: commands
  Summary: >-
    Define a local variable and set it's value
  Description: |-
    Defines, updates or deallocates a local variable.
  Usage: |-
    ```
    <stdin> -> set var_name

    # Assume value from STDIN, define the data type manually
    <stdin> -> set datatype var_name

    # Define value manually (data type defaults to string; `str`)
    set var_name=data

    # Define value and data type manually
    set datatype var_name=data

    # Define a variable but don't set any value
    set var_name
    set datatype var_name
    ```
  Examples: |-
    As a method:
    
    ```
    » out "Hello, world!" -> set hw
    » out "$hw"
    Hello, World!
    ```
    
    As a function:
    
    ```
    » set hw="Hello, world!"
    » out "$hw"
    Hello, World!
    ```
  Flags:
  Detail: |-
    ### Deallocation

    You can unset variable names with the bang prefix:

    ```
    !set var_name
    ```

    {{ include "gen/includes/variables.inc.md" }}
  Synonyms:
  - set
  - "!set"
  Related:
  - global
  - let
  - equ
  - expr
  - export
  - exec
  - brace-quote
  - index
  - element
  - user-guide/scoping
  - user-guide/reserved-vars


- DocumentID: global
  Title: >+
    `global`
  CategoryID: commands
  Summary: >-
    Define a global variable and set it's value
  Description: |-
    Defines, updates or deallocates a global variable.
  Usage: |-
    ```
    # Assume data type and value from STDIN
    <stdin> -> global var_name

    # Assume value from STDIN, define the data type manually
    <stdin> -> global datatype var_name

    # Define value manually (data type defaults to string; `str`)
    global var_name=data

    # Define value and data type manually
    global datatype var_name=data

    # Define a variable but don't set any value
    global var_name
    global datatype var_name
    ```
  Examples: |-
    As a method:
    
    ```
    » out "Hello, world!" -> global hw
    » out "$hw"
    Hello, World!
    ```
    
    As a function:
    
    ```
    » global hw="Hello, world!"
    » out "$hw"
    Hello, World!
    ```
  Flags:
  Detail: |-
    ### Deallocation

    You can unset variable names with the bang prefix:

    ```
    !global var_name
    ```

    {{ include "gen/includes/variables.inc.md" }}
  Synonyms:
  - global
  - "!global"
  Related:
  - set
  - let
  - equ
  - expr
  - export
  - brace-quote
  - index
  - element
  - user-guide/scoping
  - user-guide/reserved-vars


- DocumentID: export
  Title: >+
    `export`
  CategoryID: commands
  Summary: >-
    Define an environmental variable and set it's value
  Description: |-
    Defines, updates or deallocates an environmental variable.
  Usage: |-
    ```
    <stdin> -> export var_name

    export var_name=data
    ```
  Examples: |-
    As a method:
    
    ```
    » out "Hello, world!" -> export hw
    » out "$hw"
    Hello, World!
    ```
    
    As a function:
    
    ```
    » export hw="Hello, world!"
    » out "$hw"
    Hello, World!
    ```
  Flags:
  Detail: |-
    ### Deallocation

    You can unset variable names with the bang prefix:

    ```
    !export var_name
    ```

    For compatibility with other shells, `unset` is also supported but it's really
    not an idiomatic method of deallocation since it's name is misleading and
    suggests it is a deallocator for local Murex variables defined via `set`.

    ### Exporting a local or global variable

    You can also export a local or global variable of the same name by specifying
    that variable name without a following value. For example

    ```
    # Create a local variable called 'foo':
    » set: foo=bar
    » env -> grep: foo
    
    # Export that local variable as an environmental variable:
    » export: foo
    » env -> grep: foo
    foo=bar

    # Changing the value of the local variable doesn't alter the value of the environmental variable:
    » set: foo=rab
    » env -> grep: foo
    foo=bar
    » out: $foo
    rab
    ```

    {{ include "gen/includes/variables.inc.md" }}
  Synonyms:
  - export
  - "!export"
  - unset
  Related:
  - set
  - let
  - equ
  - expr
  - global
  - brace-quote
  - user-guide/scoping
  - user-guide/reserved-vars
