saker.build Documentation TaskDoc JavaDoc Packages
  1. saker.build
  2. Scripting language
  3. Language reference
  4. Operators
  5. Dereference

Dereference

Dereferencing an expression allows the code to access a variable with the specified name. The result of a dereference expression can be used as the left side operand of an assignment. (See Assignment)

Dereferencing a variable is semantically the same as using the var() task. Additionally, dereferencing differs from var() in a way that it can be used to access loop and local variables in the body of a foreach expression.

Both simple and complex expressions can be the subject of dereferencing.

See Variables for more information.

# assign 123 to the variable named "var"
$var = 123
# assign 456 to the variable named "var6"
$"var{ 2 * 3 }" = 456
# assign the value of $var to $alias
$alias = $var