7.2.2. Optional arguments

Gamma allows optional arguments at the end of an argument list. An optional argument is specified by appending a question mark (?) to an argument in the function's argument list. All arguments after the first optional argument are implicitly optional as well. If the caller wants to provide a value to an optional argument, then the caller must also provide values for all preceding optional arguments. If an optional argument is not provided during the call, then the argument will take on the value UNDEFINED, which must be dealt with within the body of the function. A default value for an optional argument can also be provided in the function definition. For example,

function f (x, y?, z=5)

creates a function with 1 mandatory argument and two optional arguments. The argument y has no default value, and z has a default value of 5. This function could be called as f(1), f(1,2) or f(1,2,3).