An operand is a subexpression that supplies an input to an operation. A binary operation combines two operands: the left operand and the right operand. Each operand evaluates to a value, such as a discount percentage or rental price. section 11.1 section 11.6
Operand placement depends on the operator notation:
- Infix notation places the operator between two operands, as in 1 / 2. section 11.1
- Prefix notation places the operator before its operand or operands, as in ! false or - 42. section 11.1
- Postfix notation places the operator after its operand or operands, as in i++ or j--. section 11.1
Calculating a rental discount
The expression “20% of $60” has two operands: the discount percentage and the rental price before discount. The “of” operator combines them and produces $12. In an expression model, these operands can be represented as subexpressions for attribute references or other operations. section 11.1 section 11.6
Table 11.1 Expression concepts and their properties
|
Concept
|
Arity (properties containing subexpressions)
|
Other properties
|
|---|---|---|
Attribute Reference
|
0
|
"attribute" (a reference to an
Attribute)
|
Binary Operation
|
2 ("left operand", "right operand")
|
"operator" (a value from a small, fixed set of strings)
|
Number
|
0
|
"value" (a string that represents a number value)
|
Compare expression concepts by arity and identify the two operand properties that make Binary Operation a binary expression. section 11.5.1
