Old (keyword)

From The Oxygene Language Wiki
Jump to: navigation, search

This is a Language topic about Oxygene
 

Language Topics Introduction | Structured Overview | Grammar | Keywords | Functions



The old keyword is provided for use in ensure sections only. It allows you to test the effect on a field during a method, e.g.:

method MyObject.Add(aItem: ListItem);
begin
  InternalList.Add(aItem);
ensure
  Count = old Count +1;
end;

"old" is only supported for integers and value types for local variables & parameters and the compiler saves the values of the field(s) as they were at the start of the method.


See Also

Personal tools
Namespaces

Variants
Actions
Navigation
Getting Started
Sections
If you know
More
Toolbox