## Using arguments in Icon procedures |

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 (See the previous page,
`Using procedures in Icon', for the `Factorial()`

procedure.)

Site map

To report a problem:

Send mail to the

John Shipman, john@nmt.edu
Last updated: 1996/01/06 21:12:57 UTURL: http://www.nmt.edu/tcc/help/lang/icon/procargs.html |