Lexical Scoping
Curly braces define scope. Both for regular variables and for functions. We cannot use the global version of f() if we declare f internally as well.
h() {
print("In external h");
}
f() {
print("In f");
g() {
print("In g");
}
h() {
print("In internal h");
}
g();
h();
}
main() {
f();
//g(); // Not declared
//f() {
// print("New f");
//}
h();
}
{% embed include file=“src/examples/dart-intro/lexical_scope.out)