Next / Previous / Index / ITC Help System / Publications / Site map / NM Tech homepage

Examples of structure passing in Icon

Tech Computer Center logo

Here are some small programs that illustrate passing data structures to Icon procedures:

    procedure main()
      L  :=  [ 1, 2, 3 ];    # Set L to a list of 3 small integers
      Change_All ( L );      # This procedure does not affect L
      every write ( ! L );   # Display the values of L
      Change_One ( L );      # This procedure changes the first element of L
      every write ( ! L );   # Display the values of L
    end
    procedure Change_All ( foo )  # This does not affect the caller's foo...
     foo  :=  86;                 # ...because we are not changing...
    end                           # ...a PART of an aggregate
    procedure Change_One ( foo )  # This procedure affects the caller's foo...
      foo[1]  :=  99;             # ...because we are changing...
    end                           # ...a PART of an aggregate

Next: Using the copy() function in Icon
See also: Using data structures in Icon
Previous: Passing data structures to Icon procedures
Site map
Index: Keyword index to help pages
Help: New Mexico Tech Information Technology and Communications: Help System
ITC Publications
To report a problem: File a ticket
Send mail to the User consultant on duty or call them at 575-835-5437
Home: About New Mexico Tech

John Shipman, john@nmt.edu
Last updated: 1996/01/06 21:12:57 UT
URL: http://www.nmt.edu/tcc/help/lang/icon/passexamp.html
QR two-dimensional bar code