Skip to content

Instantly share code, notes, and snippets.

@shmup
Last active June 28, 2017 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shmup/e912ca6ccfc4ae86dfd135ef78af95fc to your computer and use it in GitHub Desktop.
Save shmup/e912ca6ccfc4ae86dfd135ef78af95fc to your computer and use it in GitHub Desktop.
type
Vector = object
x, y: int
proc add(a, b: var Vector): Vector =
a.x += b.x
a.y += b.y
var v1 = Vector(x: -1, y: 4)
var v2 = Vector(x: 5, y: -2)
discard add(v1, v2)
discard v1.add(v2)
discard v2.add(v1)
discard v1.add(v2).add(v1).add(v2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment