call

From Kolmafia
Revision as of 21:55, 17 September 2014 by imported>Bale (http://kolmafia.us/showthread.php?1349-Can-I-sort-an-array-Can-I-call-a-method-if-given-a-reference&p=9021&viewfull=1#post9021)
Jump to navigation Jump to search

Syntax: call [type] <identifier>( param, ... );

type is an optional parameter which must match the return value of the function. If not specified, type defaults to void.

For instance:

int foo( int a, int b )
{
  return a + b;
}

String a = "foo";

float c = call float a( 2, 3 );

print( "c = " + c );

a = "print";

call a( "print 1" );

print( "done" );

will output the following to the CLI:

c = 5.0
print 1
done

Formatting Needed