| AngelScript |

Function declaration

Global functions provide the mean to implement routines that should operate on some input and produce a result. The functions themselves do not keep any memory, though they can update global variables, or memory passed by reference.

The function is always declared together with the function body. There is no need to declare function prototypes, as the function is globally visible regardless where it has been declared.

      // A simple function declaration
      int AFunction(int a, int b)
      {
        // Implement the function logic here
        return a + b;
      }

The type of the return value should be specified before the name of the function. If the function doesn't return anything the type should be defined as 'void'. After the function name, the list of parameters is specified between parenthesis. Each parameter is defined by its type and name.