[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.11.1 Default arguments
Asymptote
supports a more flexible mechanism for default function
arguments than C++: they may appear anywhere in the function prototype.
Because certain data types are implicitly cast to more sophisticated
types (see section Casts) one can often avoid ambiguities by ordering
function arguments from the simplest to the most complicated.
For example, given
real f(int a=1, real b=0) {return a+b;}
then f(1)
returns 1.0, but f(1.0)
returns 2.0.
The value of a default argument is determined by evaluating the
given Asymptote
expression in the scope where the called
function is defined.