equal
deleted
inserted
replaced
18 (1 to 10).toList |
18 (1 to 10).toList |
19 |
19 |
20 (1 until 10).toList |
20 (1 until 10).toList |
21 |
21 |
22 // an element in a list |
22 // an element in a list |
23 List(1, 2, 3, 1)(0) |
23 val lst = List(1, 2, 3, 1) |
24 List(1, 2, 3, 1)(3) |
24 lst(0) |
|
25 lst(2) |
25 |
26 |
26 1::2::3::Nil |
27 1::2::3::Nil |
27 List(1, 2, 3) ::: List(4, 5, 6) |
28 List(1, 2, 3) ::: List(4, 5, 6) |
28 |
29 |
29 // Printing/Strings |
30 // Printing/Strings |
30 //================== |
31 //================== |
31 |
32 |
32 println("test") |
33 println("test") |
33 |
34 |
34 |
35 val tst = "This is a " + "test\n" |
35 val tst = "This is a " ++ "test\n" |
|
36 println(tst) |
36 println(tst) |
37 |
37 |
38 val lst = List(1,2,3,1) |
38 val lst = List(1,2,3,1) |
39 |
39 |
40 println(lst.toString) |
40 println(lst.toString) |
41 println(lst.mkString("\n")) |
41 println(lst.mkString("\n")) |
|
42 |
|
43 println(lst.mkString(", ")) |
42 |
44 |
43 // some methods take more than one argument |
45 // some methods take more than one argument |
44 println(lst.mkString("[", ",", "]")) |
46 println(lst.mkString("[", ",", "]")) |
45 |
47 |
46 |
48 |