Last active
June 28, 2017 15:11
-
-
Save shmup/e912ca6ccfc4ae86dfd135ef78af95fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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