Next: , Up: Expressions


3.1 Range expressions

Range expressions are used to index into arrays.

     x[0..3]

references the first four elements of array x.

Limits: interpretation of negative ranges? Are we allowing negative indices?

Implicit ranges.

Explicit ranges. Q: does x<=y? If we allow negative indices then yes, because we need to be able to express empty ranges, when x>y.

Compile-time (meta-language) interpretation.

See chapter on compile-time flow-control (loops and conditionals).