-
-
Notifications
You must be signed in to change notification settings - Fork 9
Multiply Operator
IsaacShelton edited this page Mar 21, 2022
·
1 revision
The * operator is used for multiplying two numeric types.
1 * 2
The * operator can be defined for non-numeric types or type combinations with the following:
func __multiply__(a $A, b $B) $C
where $A, $B and $C are any valid types
See __multiply__ for more information.
A common usage of the * operator (for non-numeric types) is repeating a String value:
"\n" * 10
Allowed by the following definition:
func __multiply__(lhs String, times int) String