The type extension example included with Astrobe contains the following code snippet:The type T of the case expression (case variable) may also be a record or pointer type. Then the case labels must be extensions of T, and in the statements Si labelled by Ti, the case variable is considered as of type Ti.
Code: Select all
IF shape IS Square THEN Out.String("Square")
ELSIF shape IS Rectangle THEN Out.String("Rectangle")
ELSIF shape IS Circle THEN Out.String("Circle")
ELSIF shape IS Ellipse THEN Out.String("Ellipse")
END
Code: Select all
CASE shape OF
Square: Out.String("Square")
| Rectangle: Out.String("Rectangle")
| Circle: Out.String("Circle")
| Ellipse: Out.String("Ellipse")
END