Skip to content

Instantly share code, notes, and snippets.

@taitruong
Last active August 29, 2015 13:57
Show Gist options
  • Save taitruong/9465709 to your computer and use it in GitHub Desktop.
Save taitruong/9465709 to your computer and use it in GitHub Desktop.
Variable scope: inner / outer
object ScalaHackSession {
val i = 0 //> i : Int = 0
val scope = "outer scope" //> scope : String = outer scope
if (i == 0) {
val scope = "inner scope"
println(scope + ": " + i)
} //> inner scope: 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment