home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / hypercar / 4616 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.1 KB  |  45 lines

  1. Newsgroups: comp.sys.mac.hypercard
  2. Path: sparky!uunet!nwnexus!tbenedic
  3. From: Tom Benedict <tbenedic@halcyon.com>
  4. Subject: Re: Initializing HC variables
  5. Message-ID: <Lgy2VB2w165w@halcyon.com>
  6. Originator: bbs@halcyon.com
  7. Sender: sso@nwnexus.WA.COM (System Security Officer)
  8. Organization: The 23:00 News and Mail Service
  9. References: <7183@ucsbcsl.ucsb.edu>
  10. Date: Sat, 19 Dec 1992 23:15:32 GMT
  11. Lines: 32
  12.  
  13. sekey@engrhub.ucsb.edu (Andrew Sekey) writes:
  14.  
  15. >     Suppose we have an array of variables x1, x2, x3, etc, and we want to
  16. > initialize them to zero, i.e. to set:
  17. >     x1 = 0;  x2 = 0, ........xN = 0.
  18. >     Can this be done in a "repeat" structure?
  19. > (What would be obvious in e.g. Fortran, does not work:
  20. >     repeat with j = 0 to N
  21. >         put 0 into x & j
  22. >         end repeat
  23. > since even including a line  'put x & j into dummy', when followed by 
  24. > 'put 0 into dummy', will only change 'dummy', not xj.)
  25. > Any offers?
  26. > Andrew
  27.  
  28. You need to use the 'do' command. 
  29. Try to following script
  30. repeat with y = 1 to 5
  31.     get "x"&y
  32.     do "put"&&0&&"into"&&it
  33. end repeat
  34.  
  35. Tom Benedict
  36.