FUNCTION
is a method which returns a result. Sometimes the result is a manipulation of the header parameters, or the result can simple be an error check result, error or success. A useful rule of thumb on when to implement a set of instructions as a procedure or function is, could these group of commands be used again in the future of this project.
Function DoSomething(Para:String):String; begin Writeln(%u2019Got parameter : %u2019,Para); Writeln(%u2019Parameter in upper case : %u2019,UpperCase(Para)); Result:=Lowercase(Para); end; begin Writeln('Lowercase result : ',DoSomething('Hello World!'); end.Source: Reserved Words