Uniform function call syntax: Difference between revisions

Content deleted Content added
m spelling
Shmup (talk | contribs)
adding a Nim example, as it is listed in the languages above
Line 75:
Bar::g(&q);
}
</source>
 
=== Nim programming language ===
<source lang="Nim">
type
Vector = object
x, y: int
 
# https://nim-lang.org/docs/tut1.html#procedures-discard-statement
proc add(a, b: var Vector): var Vector {.discardable.} =
a.x += b.x
a.y += b.y
 
var v1 = Vector(x: -1, y: 4)
var v2 = Vector(x: 5, y: -2)
 
add(v1, v2)
v1.add(v2)
v2.add(v1)
v1.add(v2).add(v1).add(v2)
</source>