Last active
February 13, 2020 02:09
-
-
Save silvernode/003571ac561211212fecd35208762f72 to your computer and use it in GitHub Desktop.
Learning types and seqs
This file contains hidden or 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
import strformat | |
type | |
Character* = object | |
name*, location*: string | |
credits*: int | |
ship*: string | |
type | |
Ship* = object | |
name*: string | |
hp*: int | |
cargo*: seq | |
var ship1: Ship | |
ship1 = Ship(name: "Dover", | |
hp: 100, | |
cargo: @["fuel"]) | |
var player: Character | |
player = Character(name: "Dave", | |
location: "start", | |
credits: 200, | |
ship: ship1.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment