PDA

View Full Version : Default function arguments declaration


Nicool
06-07-2003, 11:29 AM
Hye,
I wonder if it is possible to set default value to the varaible needed for a function. As possible in renderman *.sl
Like :
global pro coco (int $nb=3, float $val=2.73) {
;
}


If the user doesn't give his value, it would those default ones.

:beer:

Nicool
06-23-2003, 06:44 PM
NO !

You cannot use a default argument when you declare a function. A function is a procedure with a return value. When you execute a function, you must provide all arguments.

For example, you cannot declare a function as follows:

proc int splat (int $value, bool = true)

The assignment (=) in the statement creates a default assignment in C. It is not allowed in MEL.

CGTalk Moderation
01-15-2006, 08:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.