Visibility scopes

In Mirelle, variable scopes are defined by the following constructions:

A local variable will be visible from the point of it's definition till the end of the block it has been defined in. All nested blocks can also access the variable.

var a = 10
if a > 5 do
{
  var b = 5
  if b > 1 do
    print b
}
else
{
  // the following statement is erroneous,
  // because the 'b' variable is not visible
  print b
}

Last edited Mar 17, 2011 at 9:19 AM by impworks, version 2

Comments

No comments yet.