progs/lecture1.scala
changeset 23 8ac886bb0c15
parent 21 610f7a4a9ede
child 25 6253f4681451
--- a/progs/lecture1.scala	Wed Nov 09 06:02:55 2016 +0000
+++ b/progs/lecture1.scala	Wed Nov 09 13:09:38 2016 +0000
@@ -20,9 +20,11 @@
 (1 until 10).toList
 
 // an element in a list
-List(1,2,3,1)(0)
-List(1,2,3,1)(3)
+List(1, 2, 3, 1)(0)
+List(1, 2, 3, 1)(3)
 
+1::2::3::Nil
+List(1, 2, 3) ::: List(4, 5, 6)
 
 //**Printing/Strings**
 //====================
@@ -52,7 +54,7 @@
 //**Types**
 //=========
 
-// Int, Long, BigInt
+// Int, Long, BigInt, Float, Double
 // String, Char
 // List[Int], Set[Double]
 // Pairs: (Int, String)        
@@ -61,7 +63,23 @@
 
 //**Smart Strings**
 //=================
-""" """
+println(">\n<")
+println(""">\n<""")
+
+/* in Java
+val lyrics = "Baa, Baa, Black Sheep \n" +
+             "Have you any wool? \n" +
+             "Yes, sir, yes sir \n" +
+             "Three bags full"
+*/ 
+
+val lyrics = """Baa, Baa, Black Sheep  
+                |Have you any wool?
+                |Yes, sir, yes sir
+                |Three bags full""".stripMargin
+
+println(lyrics)
+
 
 //**Pairs/Tuples**
 //================