equal
  deleted
  inserted
  replaced
  
    
    
     9 val y = 3 + 4  | 
     9 val y = 3 + 4  | 
    10 val z = x / y  | 
    10 val z = x / y  | 
    11   | 
    11   | 
    12   | 
    12   | 
    13 // (you cannot reassign values: z = 9 will give an error)  | 
    13 // (you cannot reassign values: z = 9 will give an error)  | 
         | 
    14   | 
         | 
    15   | 
         | 
    16   | 
         | 
    17 // Hello World  | 
         | 
    18 //=============  | 
         | 
    19   | 
         | 
    20 // an example of a stand-alone scala file;  | 
         | 
    21 // in the coursework students must submit   | 
         | 
    22 // plain scala "work-sheets"  | 
         | 
    23   | 
         | 
    24 object Hello extends App {  | 
         | 
    25   println("hello world") | 
         | 
    26 }  | 
         | 
    27   | 
         | 
    28 // can be called with  | 
         | 
    29 //  | 
         | 
    30 // $> scalac hello-world.scala  | 
         | 
    31 // $> scala Hello  | 
         | 
    32 //  | 
         | 
    33 // $> java -cp /usr/local/src/scala/lib/scala-library.jar:. Hello  | 
         | 
    34   | 
         | 
    35   | 
    14   | 
    36   | 
    15   | 
    37   | 
    16 // Collections  | 
    38 // Collections  | 
    17 //=============  | 
    39 //=============  | 
    18 List(1,2,3,1)  | 
    40 List(1,2,3,1)  | 
   124 p._2  | 
   146 p._2  | 
   125   | 
   147   | 
   126 val t = (4,1,2,3)  | 
   148 val t = (4,1,2,3)  | 
   127 t._4  | 
   149 t._4  | 
   128   | 
   150   | 
   129 // Hello World  | 
         | 
   130 //=============  | 
         | 
   131   | 
         | 
   132 // an example of a stand-alone scala file;  | 
         | 
   133 // in the coursework students must submit   | 
         | 
   134 // plain scala "work-sheets"  | 
         | 
   135   | 
         | 
   136 object Hello extends App {  | 
         | 
   137   println("hello world") | 
         | 
   138 }  | 
         | 
   139   | 
         | 
   140 // can be called with  | 
         | 
   141 //  | 
         | 
   142 // $> scalac hello-world.scala  | 
         | 
   143 // $> scala Hello  | 
         | 
   144 //  | 
         | 
   145 // $> java -cp /usr/local/src/scala/lib/scala-library.jar:. Hello  | 
         | 
   146   | 
         | 
   147   | 
   151   | 
   148 // Function Definitions  | 
   152 // Function Definitions  | 
   149 //======================  | 
   153 //======================  | 
   150   | 
   154   | 
   151 def incr(x: Int) : Int = x + 1  | 
   155 def incr(x: Int) : Int = x + 1  |