summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Nüßlein <nutz@unfoog.de>2009-07-06 21:42:42 +0200
committerAndreas Nüßlein <nutz@unfoog.de>2009-07-06 21:42:42 +0200
commit3ace855e1a5707de68c530c17f24cde226b19bb6 (patch)
tree3f50cfe587136f647ba788417af3ab9d22d40090
parentac4fb25412982447af2e718d3824e6acf7d3a2dd (diff)
downloadswppy-3ace855e1a5707de68c530c17f24cde226b19bb6.tar.gz
swppy-3ace855e1a5707de68c530c17f24cde226b19bb6.tar.xz
swppy-3ace855e1a5707de68c530c17f24cde226b19bb6.zip
ggT example
-rw-r--r--test/test5.t27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test5.t b/test/test5.t
new file mode 100644
index 0000000..c6e786d
--- /dev/null
+++ b/test/test5.t
@@ -0,0 +1,27 @@
+fun main[]
+ x = call ggt1[30,40]
+ print x
+ y = call ggt2[30,40]
+ print y
+ @x == y
+end
+
+fun ggt1[x,y]
+ while x != y
+ if x > y
+ x = x - y
+ else
+ y = y - x
+ end
+ end
+ @x
+end
+
+fun ggt2[a,b]
+ while b
+ x = a
+ a = b
+ b = x % b
+ end
+ @a
+end