News flash: I'm going to Australia in February, so this Web site may be switched off at any time.


Using Icon lists as arrays

You can refer to the elements of an Icon list by their position in the list, in much the same way that you can refer to the characters of a string (see how Icon positions are numbered). For example, this expression writes the second element of list ``L'' to the program's standard output:

    write ( L[2] );
Similarly, you can set any element of a string by assigning a value to a subscripted element of a list. This expression sets the 9th element of list L to 8.5:
    L[9]  :=  8.5;

Next: Using Icon lists as stacks
See also: Using the Icon programming language
Previous: Finding the size of an Icon list

John W. Shipman, john@nmt.edu