home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.hypercard
- Path: sparky!uunet!nwnexus!tbenedic
- From: Tom Benedict <tbenedic@halcyon.com>
- Subject: Re: Initializing HC variables
- Message-ID: <Lgy2VB2w165w@halcyon.com>
- Originator: bbs@halcyon.com
- Sender: sso@nwnexus.WA.COM (System Security Officer)
- Organization: The 23:00 News and Mail Service
- References: <7183@ucsbcsl.ucsb.edu>
- Date: Sat, 19 Dec 1992 23:15:32 GMT
- Lines: 32
-
- sekey@engrhub.ucsb.edu (Andrew Sekey) writes:
-
- >
- > Suppose we have an array of variables x1, x2, x3, etc, and we want to
- > initialize them to zero, i.e. to set:
- >
- > x1 = 0; x2 = 0, ........xN = 0.
- >
- > Can this be done in a "repeat" structure?
- >
- > (What would be obvious in e.g. Fortran, does not work:
- >
- > repeat with j = 0 to N
- > put 0 into x & j
- > end repeat
- >
- > since even including a line 'put x & j into dummy', when followed by
- > 'put 0 into dummy', will only change 'dummy', not xj.)
- >
- > Any offers?
- >
- > Andrew
- >
-
- You need to use the 'do' command.
- Try to following script
- repeat with y = 1 to 5
- get "x"&y
- do "put"&&0&&"into"&&it
- end repeat
-
- Tom Benedict
-