Functions
From Mesham
Jump to navigationJump to search
Contents
Syntax
function returntype name[arguments]
Semantics
In a function all arguments are pass by reference (even constants). If the type of argument is a type chain (requires ::) then it should be declared in the body
Example
function Int add[var a:Int,var b:Int] { return a + b; };
This function takes two integers and will return their sum.
The main function
Returns void, and like C, it can have either 0 arguments or 2. If present, the first argument is number of command line interface parameters passed in, 2nd argument is a String array containing these. Location 0 of string array is the program name.