News flash: I'm going to Australia in February, so this Web site may be switched off at any time.
Each Icon procedure starts with the keyword
procedure
followed by the name of the procedure, and
a pair of parentheses enclosing the arguments to the
procedure. Here is an example of a procedure that computes the
function C(n,k) = n!/(k!(n-k)!), the number of combinations of
n different objects taken k at a time:
procedure C(n,k) #-- # Returns the number of combinations of n things taken k at a # time, given by C(n,k) = n! / ( k! * (n-k)! ) #-- return Factorial ( n ) / ( Factorial ( k ) * Factorial ( n - k ) ); endThe statement ``
return e
''
computes the value of the expression e and exits the
procedure, substituting the value of e into the calling
expression at the location in the program where the procedure was invoked.
(See the previous page, ``Using procedures in Icon,'' for the
Factorial()
procedure.)
john@nmt.edu