progs/lecture1.scala
changeset 18 87e55eb309ed
parent 15 52713e632ac0
child 21 610f7a4a9ede
equal deleted inserted replaced
17:ecf83084e41d 18:87e55eb309ed
     1 
     1 
     2 // webpages
     2 // webpages
     3 
     3 
     4 
     4 
     5 //**Assignment (values)**
     5 //**Assignments (values)**
     6 //=======================
     6 //(variable names should be lower case)
       
     7 //=====================================
     7 val x = 42
     8 val x = 42
     8 val y = 3 + 4
     9 val y = 3 + 4
     9 
    10 
    10 
    11 
    11 //**Collections**
    12 //**Collections**
    15 
    16 
    16 1 to 10
    17 1 to 10
    17 (1 to 10).toList
    18 (1 to 10).toList
    18 
    19 
    19 (1 until 10).toList
    20 (1 until 10).toList
       
    21 
       
    22 // an element in a list
       
    23 List(1,2,3,1)(0)
       
    24 List(1,2,3,1)(3)
    20 
    25 
    21 
    26 
    22 //**Printing/Strings**
    27 //**Printing/Strings**
    23 //====================
    28 //====================
    24 
    29