Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.


7.2 One-Line Functions

Just as the IF block and FOR loop have horizontal, single line forms, so does a procedure definition. The general form is:

PROC name (arg1, arg2, ...) IS expression

Alternatively, the RETURN keyword can be used:

PROC name (arg1, arg2, ...) RETURN expression

At first sight this might seem pretty unusable, but it is useful for very simple functions and our add function in the previous section is a good example. If you look closely at the original definition you'll see that the local variable s wasn't really needed. Here's the one-line definition of add:

PROC add(x,y) IS x+y


Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.