Lvalues
Prev | Chapter 6. Programming with GEL | Next

## Lvalues

An lvalue is the left hand side of an assignment. In other words, an lvalue is what you assign something to. Valid lvalues are:

`a`

  Identifier. Here we would be setting the variable of name `a`.

`*a`

  Dereference of an identifier. This will set whatever variable `a` points to.

`a@(<region>)`

  A region of a matrix. Here the region is specified normally as with the regular @() operator, and can be a single entry, or an entire region of the matrix.

Examples:

    a:=4
    *tmp := 89
    a@(1,1) := 5
    a@(4:8,3) := [1,2,3,4,5]'

Note that both `:=` and `=` can be used interchangeably. Except if the assignment appears in a condition. It is thus always safer to just use `:=` when you mean assignment, and `==` when you mean comparison.

Prev | Up | Next
References | Home | Chapter 7. Advanced Programming with GEL