Restrictions

Functions

If you create a function from within the Inspector, such as

Square := func(x) return x * x;
there are two ways to call it. One is to use call syntax:

call Square with (3);
The other is to use message sending syntax. Since self is the globals frame, and the Square function is now a slot (method) in the globals frame, you can send the Square message to self with the following:

:Square(3);

Note:Another alternative is to use a global function declaration:
func Square(x) return x * x;
and then call the function with:
Square(3);


An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996