Lingo Dictionary > O-R > param()

 

param()

Syntax

param(parameterPosition)

Description

Function; provides the value of a parameter passed to a handler. The expression parameterPosition represents the parameter's position in the arguments.

To avoid errors in a handler, this function can be used to determine the type of a particular paramater.

Example

This handler accepts any number of arguments, adds all the numbers passed in as parameters, and then returns the sum:

on AddNumbers
	sum = 0
	repeat with currentParamNum = 1 to the paramCount
		sum = sum + param(currentParamNum)
	end repeat
	return sum
end

You would use it by passing in the values you wanted to add:

put AddNumbers(3, 4, 5, 6)
-- 18
put AddNumbers(5, 5)
-- 10

See also

getAt, paramCount(), return (keyword)