R5 - modelint/types GitHub Wiki

R5 / 1:Mc

Operator operates on zero, one or many Operand

Operand is operated on by exactly one Operator


Consider the Counter Type's reset operator. What does it operate on?

The Counter Type defines a single Component typed as a positive integer.

In the following Scrall action:

Detected neutrons.reset()  // Detected neutrons is typed as Counter

No operands are explicitly specified between the parentheses. In this case we presume that the reset operator modifies the Component integer value. In this case it sets it to zero.

d = Waypoint A - Waypoint B

Here two Operands are defined on the subtract Operation, on on each side of the Operator symbol.

Note, however, that this is Scrall syntax which serves only as an illustrative example.

The Operator can be thought of as subtract(left, right) with its two Operands left and right where we subtract the right from the left.