Beginners Dart - Scope
void main() {
//Declaring age.
int age = 43;
//An if statement that is processed but breaks the program as hasBills has not been defined. This is an element of scope.
if (age == 43) {
//Can’t define hasBills, bad scope.
print("You are 43 and have bills : ${hasBills}");
}else{
//Defining has bills here is too late as the program has broken.
bool hasBills = true;
print("You are ${age} and have bills ${hasBills}");
}
}