Difference between revisions of "Functions"

From Mesham
Jump to navigationJump to search
m (moved Procedures to Functions)
Line 1: Line 1:
 +
<metadesc>Mesham is a type oriented programming language allowing the writing of high performance parallel codes which are efficient yet simple to write and maintain</metadesc>
 
== Syntax ==
 
== Syntax ==
  

Revision as of 11:36, 3 July 2010

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.