Functions

param

Supported By

Syntax

[the] param of factor

param ( expression )

Factor and expression yield integers.

Example

if param(1) is empty then answer ¬
  "The first parameter is null."

Description

The param function returns a parameter value from the parameter list passed to the currently executing handler. The parameter returned is the nth parameter, where n is the integer passed to the function. The value of param(0) is the message name.

Script

The following example sums the arguments passed to it, regardless of how many there are. In other words, it is functionally equivalent to the sum function:

function addUp
  put 0 into total
  repeat with i = 1 to the paramCount
    add param(i) to total
  end repeat
  return total
end addUp

See Also

paramCount, params