Positional and Keyword Arguments
A function can take two kinds of arguments:
-
Positional Arguments. If you call a function that takes positional arguments, you must specify those arguments first and in the correct order. Positional arguments correspond to the function arguments in most programming languages—they are required and have a fixed number and order.
-
Keyword Arguments. You write keyword arguments as a keyword:value pair, and they can appear in any order after the positional arguments. Functions can use some or all of their keyword arguments as optional arguments. If you call a function and don't supply optional keyword arguments, they will either have the default value supplied by the called function, or have the special value unsupplied when first referenced in the called function.
Optional keyword arguments are useful in command languages where commands can have many options. They are particularly useful within MAX where most functions have numerous optional keyword arguments. For example, all scene object creation functions take optional keyword arguments for their creation parameters, sometimes more than 20, and using positional arguments would simply be unworkable.