Syntax![]() A type reference has the following syntax: ![]() UseA method can only refer to packages, classes, and methods that were declared before, so they cannot be declared in whatever order. This is also the case for a recursive method because the return type of a method is only known after it is declared and compiled. Consequently, it is required to predeclare the methods to enable recursion. Example1METHOD MyClass.setQuantity(quantity : Integer) : { THIS.quantity := quantity }; Example2// Pre-declaration with type of result METHOD MyClass.fibonacci(n : Integer) : VOID(Integer); // Sub-optimal implementation with 2 recursion branches created every time METHOD MyClass.finonacci(n : Integer) : { n >= 2 IF TRUE: (fibonacci(n - 1) + fibonacci(n - 2)) ELSE: 1 }; |