README
Main
object session extends App {
println("Hello world")
}
object session {
def main {
println("Hello world")
}
}Basic Defining Blocks
def example = 2 // evaluated when called
val example = 2 // evaluated immediately and immutable
var exmaple = 2 //variable and immediate
lazy val example = 2 // evaluated once when needed
def loop = loop //won't loop forever at this line
val loop = loop //will loop forever at this line
def square(x: Double) // call by value
def square(x: => Double) // call by name
def myFct(bindings: Int*) = { ... } // bindings is a sequence of int, containing a varying # of argumentsExpressions
Basic Types
Last updated