Usage

Syntax: with (object) { }

Explanation

with changes the scope of the inner block to the given object. This is often helpful when making many changes to an object at once. It is typical to do:

obj.one = value;
obj.two = value;
obj.three = value;

... but it may be easier to do:

with (obj)
{
  one = value;
  two = value;
  three = value;
}


Example

showimg(200, "image.png", 30, 30);

with (findimg(200))
{
  x = 50;
  y = 50;
}

... will draw image.png at (30, 30) and then move it to (50, 50).

Categories

CategoryLanguageConstruct

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki