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

Using the copy() function in Icon

Tech Computer Center logo

The ``copy'' function is used to create a duplicate of an aggregate structure. For example, if ``L'' is a list containing five things, ``copy(L)'' returns a new list containing the same five things.

You can use the ``copy()'' function to avoid modifying a structure that has been passed into a procedure. Be aware, though, that the copying only proceeds for one level. If ``L'' is a list containing five records, then ``copy(L)'' gives you a new list, but this new list effectively points to the same five records, so if you modify a field in one of those records, it will still affect the same record pointed at by list ``L''.

This ends our Icon tutorial. There are a lot more useful features, though. For more information, see `References for the Icon programming language'.


See also: Using data structures in Icon
Previous: Examples of structure passing in Icon
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/copy.html
QR two-dimensional bar code