home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.hypercard
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!decwrl!apple!mumbo.apple.com!gallant.apple.com!kip2-40.apple.com!user
- From: jpugh@apple.com (Jon Pugh)
- Subject: Re: User-defined functions
- Sender: news@gallant.apple.com
- Message-ID: <jpugh-051192224200@kip2-40.apple.com>
- Date: Fri, 6 Nov 1992 06:47:01 GMT
- References: <Bx733H.GM7@cmcl2.nyu.edu>
- Organization: Apple Computer, Inc.
- Followup-To: comp.sys.mac.hypercard
- Lines: 34
-
- In article <Bx733H.GM7@cmcl2.nyu.edu>, jeff@cns.nyu.edu (Jeff Fookson)
- wrote:
- >
- > As a new hypercard scripter I have noticed that user-defined function
- > definitions seem to need to specify an arguement, even if unused. Thus
- >
- > function foo
- > code
- > end foo
- >
- > gets an unrecognized keyword when called
- >
- > function foo dummy
- > code
- > end foo
- >
- > does not.
- > Is that so?
- >
- > Also, must a function explicately return something?
- > Can a function be invoked without grabbing the return somewhere? (That also
- > seems to get an `undefined'. Can one `do' a function?
-
- The trick is that you have to call functions like foo() or foo(dummy). The
- parens indicate that it is a function. This is also true for XFCNs. You
- can call handlers and XCMDs with or without parens.
-
- You should always return something in a function, otherwise you should
- write a handler. You don't have to use the return result, but you do have
- to account for it. Since parens CAN be used on handlers and XCMDs, the
- return result is used to differenciate between them. If you include a
- return statement, your function always has the value of empty.
-
- Jon
-