Created
June 28, 2017 15:40
-
-
Save shmup/f2fd90559545b1fdceb4dffc34fed33f 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): var Vector = | |
result.x = a.x + b.x | |
result.y = a.y + b.y | |
var v1 = Vector(x: -1, y: 4) | |
var v2 = Vector(x: 5, y: -2) | |
var v3 = v1.add(v2) | |
echo v1 | |
echo v2 | |
# echo v3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment