Function
add(_:_:)
Adds two values together.
func add(_ left: any EcoreValue, _ right: any EcoreValue) throws -> any EcoreValue
Parameters
left-
The left operand
right-
The right operand
Return Value
The sum of the operands
Discussion
Supports addition of numeric types (Int, Double, Float) with automatic type coercion. String concatenation is also supported when both operands are strings.
Type Coercion Rules
-
Int + Int → Int
-
Double + Double → Double
-
Int + Double → Double (Int is promoted to Double)
-
String + String → String (concatenation)