Overloaded operators: Difference between revisions

Content added Content deleted
(Added precision regarding types.)
Line 19: Line 19:


=={{header|Nim}}==
=={{header|Nim}}==
Nim allows overloading of operators. For instance, we may define a vector type and addition of vectors:
Nim allows overloading of operators. There is no restrictions regarding types of arguments when overloading an operator. For instance, we may define a vector type and addition of vectors:


<lang Nim>type Vector = tuple[x, y, z: float]
<lang Nim>type Vector = tuple[x, y, z: float]