manpagez: man pages & more
info asymptote
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.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.

This document was generated on May 24, 2014 using texi2html 5.0.

© 2000-2017
Individual documents may contain additional copyright information.