Functions with Default Values for Parameters
From ROBOTC API Guide
General Programming → Programming Tips Tricks → Functions with Default Values for Parameters
Functions can have default values for their parameters, for example:
void forward( int speed = 100 ) { motor[ port2 ] = speed; } task main() { // Forward at default forward( ); // Forward at speed 10 forward( 10 ); // Do nothing while( true ){ wait10Msec(500); } } |
If the function "forward" is called with no parameters then the default of 100 is used.
This tip was posted by jpearman over at http://www.vexforum.com/showpost.php?p=220744&postcount=1.