home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / mac / hypercar / 4100 < prev    next >
Encoding:
Text File  |  1992-11-07  |  1.6 KB  |  47 lines

  1. Newsgroups: comp.sys.mac.hypercard
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!decwrl!apple!mumbo.apple.com!gallant.apple.com!kip2-40.apple.com!user
  3. From: jpugh@apple.com (Jon Pugh)
  4. Subject: Re: User-defined functions
  5. Sender: news@gallant.apple.com
  6. Message-ID: <jpugh-051192224200@kip2-40.apple.com>
  7. Date: Fri, 6 Nov 1992 06:47:01 GMT
  8. References: <Bx733H.GM7@cmcl2.nyu.edu>
  9. Organization: Apple Computer, Inc.
  10. Followup-To: comp.sys.mac.hypercard
  11. Lines: 34
  12.  
  13. In article <Bx733H.GM7@cmcl2.nyu.edu>, jeff@cns.nyu.edu (Jeff Fookson)
  14. wrote:
  15. > As a new hypercard scripter I have noticed that user-defined function 
  16. > definitions seem to need to specify an arguement, even if unused. Thus
  17. > function foo
  18. > code
  19. > end foo
  20. > gets an unrecognized keyword when called
  21. > function foo dummy
  22. > code
  23. > end foo
  24. > does not.
  25. > Is that so?
  26. > Also, must a function explicately return something?
  27. > Can a function be invoked without grabbing the return somewhere? (That also
  28. > seems to get an `undefined'. Can one `do' a function?
  29.  
  30. The trick is that you have to call functions like foo() or foo(dummy).  The
  31. parens indicate that it is a function.  This is also true for XFCNs.  You
  32. can call handlers and XCMDs with or without parens.
  33.  
  34. You should always return something in a function, otherwise you should
  35. write a handler.  You don't have to use the return result, but you do have
  36. to account for it.  Since parens CAN be used on handlers and XCMDs, the
  37. return result is used to differenciate between them.  If you include a
  38. return statement, your function always has the value of empty.
  39.  
  40. Jon
  41.