Skip to content

Instantly share code, notes, and snippets.

@taitruong
Created March 10, 2014 14:55
Show Gist options
  • Save taitruong/9466514 to your computer and use it in GitHub Desktop.
Save taitruong/9466514 to your computer and use it in GitHub Desktop.
two line operator, expression in curled braces, 5
object ScalaHackSession {
var a = 0 //> a : Int = 0
if (a < 10) a = a + 1
println(a) //> 1
if (a < 10) a = {
println("before: " + a)
a + 1
} //> before: 1
println("after: " + a) //> after: 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment