Methods (Java/C++/C# Style)
A Jeroo program must contain exactly one main method, and usually contains several user-defined Jeroo methods
Main Method
Every Jeroo program must have exactly one main method.
method main()
{
// declare and instantiate all Jeroos // use the Jeroos to solve the problem
}
All Jeroos must be declared and instantiated at the beginning of the main method.
The rest of the main method is used to direct the actions of the Jeroos by sending them messages to execute predefined or user-defined methods.
User-Defined Jeroo Methods
A Jeroo program can have any number of user-defined Jeroo methods.
method
identifier
()
{
// body of the method
}
A user-defined method extends the capabilites of every Jeroo.
The source code in a user-defined Jeroo method must invoke a method directly, instead of sending a message to a specific Jeroo.
A user-defined Jeroo method can invoke other user-defined Jeroo methods, even itself (recursion).
User-defined Jeroo methods can appear in any order in the source code.