diff chapter7/while.scala @ 0:b316eec6fa7a draft default tip

add sample files
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 08 Jan 2013 16:41:46 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/chapter7/while.scala	Tue Jan 08 16:41:46 2013 +0900
@@ -0,0 +1,11 @@
+def gcdLoop(x: Long, y: Long): Long = {
+    var a = x
+    var b = y
+    while (a != 0) {
+	val temp = a
+	a = b % a
+	b = temp
+    }
+    b
+}
+