Subroutine definition
User defined subroutines in Mosel have to be marked with procedure / end-procedure and function / end-function respectively. The return value of a function has to be assigned to returned as shown in the following example (model subrout.mos).
model "Simple subroutines"
 declarations
  a:integer
 end-declarations
 function three:integer
  returned := 3
 end-function
 procedure print_start
  writeln("The program starts here.")
 end-procedure
 print_start
 a:=three
 writeln("a = ", a)
end-model This program will produce the following output:
The program starts here. a = 3
 
