Scope/Function names and labels: Difference between revisions

Content added Content deleted
(Scala solution added)
Line 839: Line 839:
def f() = println("calling f")
def f() = println("calling f")
}
}

val l = (i:Int, j: Int) => println(i,j)


println("Good-bye!") // will be executed
println("Good-bye!") // will be executed


}</lang>
}</lang>

=={{header|Sidef}}==
=={{header|Sidef}}==
In Sidef, the same rule which is applied to variable scoping, is applied to functions and classes as well, which means that a function defined inside another function is not visible outside the current scope.
In Sidef, the same rule which is applied to variable scoping, is applied to functions and classes as well, which means that a function defined inside another function is not visible outside the current scope.