When learning a new language, DSL or technology in general, keeping track of all the new commands can be a pain. Recently I’ve been learning Kubernetes, which is an open source system for deploying containerized applications. Learning this technology is hard enough, so I thought I would compile a short…

Recursive functions, simply put, are functions that call themselves. Fibonacci numbers, for instance, are a sequence of numbers in which each successive number is the sum of the previous 2 numbers. The first few numbers in the sequence are 1, 1, 2, 3, 5, 8, 13, 21, 34, + … n. The following is a simple method that calculates the nth Fibonacci number:

def fib_calc(n)
return n if n < 2

fib_calc(n-1) + fib_calc(n-2)
end

Thomas Dubiel

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store