diff examples/c3/functions.c3 @ 300:158068af716c

yafm
author Windel Bouwman
date Tue, 03 Dec 2013 18:00:22 +0100
parents test/c3examples/functions.c3@d9df72971cbf
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/c3/functions.c3	Tue Dec 03 18:00:22 2013 +0100
@@ -0,0 +1,27 @@
+
+/*
+ Demo of function usage
+*/
+
+module 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;
+}
+