language: Scala (scala-2.9.1)
date: 153 days 15 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
object Main {
  def main(args: Array[String]) = {
    println("Hello!")
    val x = 1.+(2) // "+" is just a method on Int
    val y = 1 + 2  // alternate syntax for methods with one parameter
    println(x + " " + y)
    val lst1 = List(1, 2, 3, 4, 5) map (x => x % 2 == 0) // map is a function on iterable types
    val lst2 = List(1, 2, 3, 4, 5) map (_ % 2 == 0) // shorthand function literal when a variable is only used once
    println(lst2)
  }
}