aboutsummaryrefslogtreecommitdiff
path: root/language/statements/variables.rst
blob: 6bc1a6f342f6a7430bc3ab9ca87b91e994c6462d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Variables
^^^^^^^^^

.. crowbar:element:: VariableDeclaration <- Type identifier ';'

    Compile-time Behavior:

    A variable declaration specifies the type and name of a variable but not its initial value.
    This is only used in :crowbar:ref:`HeaderFile`\ s as part of API boundaries.

    Runtime Behavior:

    A variable declaration has no runtime behavior.

.. crowbar:element:: VariableDefinition <- Type identifier '=' Expression ';'

    Compile-time Behavior:

    A variable definition specifies the type, name, and initial value of a variable.
    If the expression has a type which is not the type specified for the variable, an error must be emitted.

    Runtime Behavior:

    When a variable definition is executed, the expression is evaluated, and its result is made available with the given name.