comparison truffle/com.oracle.truffle.sl.test/src/tests/Fibonacci.sl @ 22201:df6a1647cfb3

Move .sl testcases/outputs (resources) into projects src directory
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Tue, 29 Sep 2015 15:01:34 +0200
parents truffle/com.oracle.truffle.sl.test/tests/Fibonacci.sl@9c8c0937da41
children
comparison
equal deleted inserted replaced
22200:7abcbeb12d08 22201:df6a1647cfb3
1 function fib(num) {
2 if (num < 1) {return 0;}
3 n1 = 0;
4 n2 = 1;
5 i = 1;
6 while (i < num) {
7 next = n2 + n1;
8 n1 = n2;
9 n2 = next;
10 i = i + 1;
11 }
12 return n2;
13 }
14
15 function main() {
16 i = 1;
17 while (i <= 10) {
18 println(i + ": " + fib(i));
19 i = i + 1;
20 }
21 }