Declares the beginning of a class method.
Method Identifier: ReturnType ( Parameters ) [ Property ] [ Abstract ] [ Final ]~n
Statements...
End [ Method ]
The Method keyword begins the declaration of a class method.
Please see the Methods section of the monkey language reference for more information on methods.
End | Class | Property | Abstract | Final
Language reference (Classes)
Language reference (Methods)
An example of methods as statements.
Class GameObject Field x:Float Field y:Float Method PrintX () Print x End Method PrintY () Print y EndEndLocal g:GameObject = New GameObjectp.x = 100p.y = 200' Accessing method...p.PrintXp.PrintYStrict mode version of above GameObject class. (Note use of Void return type.)
Class GameObject Field x:Float Field y:Float Method PrintX:Void () Print x End Method PrintY:Void () Print y EndEndMethod returning value of Float type.
Class GameObject Method AddFloats:Float (value1:Float, value2:Float) Return value1 + value2 EndEndLocal g:GameObject = New GameObject' Accessing method...Print g.AddFloats (1.5, 2.0)