Function declarations

Functions aggregate statements are the basis for structural programming in BI#. The declaration of functions has this structure:

<type> <name> ( [parameters] ) <block>

A function's name must be a valid BI# identifier. Its type can be every BI# type or it can be void, if the function does not return a value. In addition, a function may accept a list of parameters. This example shows the basic function definition:

void DoNothing()
{ 
}

This statement defines a function named DoNothing that does not return a value and does not expect any parameters. Its block is empty, so it does nothing.

The next function is a bit more complex:

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

The Add function takes two int parameters named a and b and returns their sum.

BI# allows to define different functions that have the same name, if they have different parameter lists. For example, it is completely valid to define another Add function:

string Add(string a, string b)
{ 
	return a + b; 
}

This function returns the sum of two strings, that is, it concatenates them.