RosettaCodeData/Task/Fibonacci-sequence/E/fibonacci-sequence.e

9 lines
124 B
Text
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
def fib(n) {
var s := [0, 1]
for _ in 0..!n {
def [a, b] := s
s := [b, a+b]
}
return s[0]
}