Gilda incorporates several interrelated features to help manage side effects. Functions are pure; which means they do not have side effects other than returning a value. They cannot modify their arguments nor any global variables, perform input or output operations, or raise or catch exceptions. They can only call other functions or methods that are also pure. Due to these restrictions they can freely be used in expressions without concern for side effects that would otherwise not be obvious.
function Name :Denote the start of a function. entry Parameter, ... :There may be none or several input parameters. exit Result :A single return value is required. : :Additional declarations and executable statements. return :The last line is always a return statement.
Function calls can be coded using either functional or subroutine notations:
Result = Fn( [Argument, ...] ); Function syntax. FN [Argument, ..., ] Result; Subroutine syntax.
An example of a user defined function is: is.prime.gg
A set of intrinsic functions are built into Gilda. They perform common numeric and string operations and type casts.