X-Git-Url: http://nitlanguage.org diff --git a/examples/fibonacci.nit b/examples/fibonacci.nit index d4330ba..50b93be 100644 --- a/examples/fibonacci.nit +++ b/examples/fibonacci.nit @@ -15,18 +15,15 @@ # limitations under the License. # Simple example of refinement where a method is added to the integer class. -module fibonacci +module fibonacci is example redef class Int # Calculate the self-th element of the fibonacci sequence. fun fibonacci: Int do - if self < 2 then - return 1 - else - return (self-2).fibonacci + (self-1).fibonacci - end - end + if self < 2 then return self + return (self-2).fibonacci + (self-1).fibonacci + end end # Print usage and exit.