|
|||||
Functions: passing expressions as arguments | |||||
Prerequisite Concepts | Related Syntax |
A value argument is used to pass an expression as a function argument. Any expression can be passed as a value argument of a compatible type:
Unlike read-only arguments, when a shelf item reference is passed as a value argument, only the value of that item is passed. Inside the function, that value argument cannot be used to access the key of that item (if any) or the values or keys of any of the other items on the shelf.
Within a function, a value argument is treated as if it were a "read-only" shelf with a single item (initialized to the passed value) and no key. (This is often referred to as a scalar shelf.) A value argument never has a key, even if a shelf item which does have a key is passed as a value argument.
Value arguments are used whenever it is desirable to pass the result of an expression as an argument.
A value argument may be passed to another called function as a value or read-only argument or as part of a remainder argument.
Prerequisite Concepts Functions Functions: argument classes |
Related Syntax define function remainder value |
---- |