Mercurial > lcfOS
diff python/c3/examples/functions.c3 @ 251:6ed3d3a82a63
Added another c3 example. First import attempt
author | Windel Bouwman |
---|---|
date | Mon, 29 Jul 2013 20:23:13 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/c3/examples/functions.c3 Mon Jul 29 20:23:13 2013 +0200 @@ -0,0 +1,27 @@ + +/* + Demo of function usage +*/ + +package functiondemo; + +function void main() +{ + var int a, b, c; + a = 3; + b = a; + a =3; + b = fib(a + 9); + sum(a, b); +} + +function int fib(int x) +{ + return fib(x - 1) * x; +} + +function int sum(int a, int b) +{ + return a + b; +} +