Skip to content

25 Value declarations ​

A value groups immutable fields into a typed data value.

norm
value Position {
  Integer row
  Integer column
}

main() {
  Position cursor = Position(row: 2, column: 4)
  printLine(cursor.row)
  printLine(cursor.column)
}

Expected output:

text
2
4

Construction names each field. After creation, those fields are read-only; use another value when coordinates change. This makes a position describe data rather than a changing entity.

Try it: Create a second position with a different column.

Precise rules: Reference.

Norm 0.25