progs/lecture1.scala
changeset 195 fc3ac7b70a06
parent 189 ff815ca0bbcf
child 199 54befaf23648
--- a/progs/lecture1.scala	Fri Oct 05 11:27:16 2018 +0100
+++ b/progs/lecture1.scala	Sat Nov 03 11:07:44 2018 +0000
@@ -554,3 +554,41 @@
 
 time_needed(10, santa_state(large_string))
 time_needed(10, santa_imutable(large_string))
+
+
+
+
+
+//=======================
+// equality is structural
+val a = "Dave"
+val b = "Dave"
+
+if (a == b) println("equal") else println("unequal")
+
+
+
+List.fill(10)(math.random)
+
+//------------------------
+
+
+for (a <- 0 to 10) {
+  println(a)
+}
+
+for (a <- 0 until 10) {
+  println(a)
+}
+
+for (a <- 0 until 2; b <- 0 to 2) {
+  
+}
+
+output
+a=0, b=0
+a=0, b=1
+a=0, b=2
+a=1, b=0
+a=1, b=1
+a=1, b=2