Skip to main content

Relative Dot Syntax (..)

Relative Dot Syntax (..)

The relative dot syntax (..) provides a mechanism for referencing a method or property in the current context. The context for an instance method or a property is the current instance; the context for a class method is the class in which the method is implemented. You cannot use relative dot syntax in a class method to reference properties or instance methods, because these require the instance context.

For example, suppose there is a Bricks property of type %Integer:

Property Bricks As %Integer;

A CountBricks() method can then refer to Bricks with relative dot syntax:

Method CountBricks()
{
    Write "There are ",..Bricks," bricks.",!
}

Similarly, a WallCheck() method can refer to CountBricks() and Bricks:

Method WallCheck()
{
    Do ..CountBricks()
    If ..Bricks < 100 {
        Write "Your wall will be small."
    }
}
FeedbackOpens in a new tab