A method is a subroutine.
Method definition is the following format.
access-control method return-type method-name(arguments)
In the class definition, it is possible to define methods of any number at any place outside the other member definitions.
Access-control determines the access level of the method by specifying a keyword either open or closed.
If the access-control is open, you can invoke the method from outside the class definition. If the access-control is closed, you can invoke the method only inside the class definition.
method keyword indicates that this definition is method. It must be present between the access-control and return-type.
The return-type is a specification of a type of instance which is returned by method.
You must specify a void if the method does not return a value.
The method-name is a identifier.
The arguments are pairs of the class name and identifier which is surrounded by parentheses. the pair can be specified any number. When there are two or more the pair, it have to separate by comma.
open method void sampleMethod()
open method void sampleMethod(int index)
open method void sampleMethod(int index, string message)
There is not a special keyword which indicates that there is no arguments. If the argument is not, you do not have to specify anything in the parentheses
An endmethod is a keyword which indicates an end of a method definition. It has to exist at the end of a definition.
You can define methods of any number which has same name if type and number of arguments are different.
A method generates a scope.
Please refer to the manual about the scope.
A method can return to invoker from anywhere by return statement. The return statement of the method should return an instance of the type which is specified