Skip to content

Instantly share code, notes, and snippets.

@silvernode
Last active February 13, 2020 02:09
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 silvernode/003571ac561211212fecd35208762f72 to your computer and use it in GitHub Desktop.
Save silvernode/003571ac561211212fecd35208762f72 to your computer and use it in GitHub Desktop.
Learning types and seqs
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