progs/lecture1.scala
changeset 265 59779ce322a6
parent 247 50a3b874008a
child 268 e43f7e92ba26
--- a/progs/lecture1.scala	Wed Mar 20 21:50:20 2019 +0000
+++ b/progs/lecture1.scala	Sat Jun 22 08:39:52 2019 +0100
@@ -143,6 +143,16 @@
 val name: String = "leo"
 
 
+// type errors
+math.sqrt("64")
+
+// produces
+//
+// error: type mismatch;
+// found   : String("64")
+// required: Double
+// math.sqrt("64")
+
 // Pairs/Tuples
 //==============
 
@@ -468,6 +478,15 @@
 count_intersection2(A, B)
 
 
+//another example
+def test() = {
+  var cnt = 0
+  for(i <- (1 to 1000000).par) cnt += 1
+  println(cnt)
+}
+
+test()
+
 //for measuring time
 def time_needed[T](n: Int, code: => T) = {
   val start = System.nanoTime()