Functions are like small programs in themselves that live inside your main program - they are rather like Subroutines.
Functions can just do something :
Rem Start of Program
Say_Hello()
Rem End of Program
End
Function Say_Hello()
Print "Hello"
EndFunction
They can have parameters passed to them and use those parameters :
Rem Start of Program
Say_Something("Hello")
Rem End of Program
End
Function Say_Something(ThingToSay$)
Print ThingToSay$
EndFunction
The most useful thing they can do though is work something out, and pass it back :
Rem Start of Program
Age = My_Age()
Print Age
Rem End of Program
End
Function My_Age()
MyAge = 33
EndFunction MyAge
Functions are defined by Function <name> - and as soon as an EndFunction line is reached, the function is "closed".
Functions are called just by inserting the name of the function in your program.
Hope this helps.