Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!aurora!ames!ll-xn!mit-eddie!uw-beaver!ubc-vision!alberta!calgary!freedman From: freedman@calgary.UUCP (Dan Freedman) Newsgroups: comp.sys.mac Subject: Re: HyperCard arrays Message-ID: <1176@vaxb.calgary.UUCP> Date: Fri, 30-Oct-87 00:09:09 EST Article-I.D.: vaxb.1176 Posted: Fri Oct 30 00:09:09 1987 Date-Received: Sun, 8-Nov-87 02:47:22 EST References: <173@stech.UUCP> Organization: U. of Calgary, Calgary, Ab. Lines: 27 In article <173@stech.UUCP>, sysop@stech.UUCP (Jan Harrington) writes: > HyperTalk doesn't directly support arrays. Is there some way to get the > same effect (by using variables names like VName & k, where k contains > a number that changes?)? The easiest way is to use HyperTalk's "item" syntax. You can say, for instance: put 3 into item 9 of theArrayVariable and, nicely enough, if theArrayVariable has less than n items in it when you tell it to put something into item n, hypercard will pad out the variable with the appropriate number of empty items, meaning that you don't even have to worry about initializing the variable. Items in hypercard are things separated in a variable or field by commas, so a variable with 3 as the first item, 8 as the fifth item, and 21 as the ninth item would look like this: 3,,,,8,,,,21 To access an item of a field or variable, just say: get item 4 of theArrayVariable Needless to say, the item specifier can be a variable, which makes the implementation of arrays really easy! Dan Freedman University of Calgary Computer Science Department