🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #21259

Re: HyperCard arrays

#21259
From: Dan Freedman
Date: Fri, 30 Oct 1987 05:09
27 lines
1680 bytes
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
Technical Details
Message-ID: <1176@vaxb.calgary.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!aurora!ames!ll-xn!mit-eddie!uw-beaver!ubc-vision!alberta!calgary!freedman
References: <173@stech.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!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