previous chapterthe pico pagenext chapter


Table assignment

Tables bound to variables can have a slot value changed by a table assignment:

name[expression]:= expression

The name should refer to a variable that has a table bound to it in the current dictionary. The value of the expression between square brackets must be a number compatible with the size of the table and will result in the index of a slot. The value of this slot will be replaced by the value of the expression on the right-hand side; the updated table will be returned as the value of the table assignment.

In the above transcript table assignment is used to initialise a table Months holding the number of days in each of the twelve months. Note that the table index -ranging from 1 through 12- identifies the month.


previous chapterthe pico pagenext chapter