function returnType functionName (type1 arg1, type2 arg2,..., typeN argN) {
variableDeclarations
otherFunctionDeclarations
Statements
Mappings
return [expression];
}
Functions
You can define your own functions in the following way:
You must put the return statement at the end.
For more information about the return statement, see Return Statement.
Inside some functions, there can be Mappings
.
These may be in any place inside the function.
In addition to any other data type mentioned above, the function can also return void
.
function integer add (integer i1, integer i2) {
return i1 + i2;
}