Skip to content

Instantly share code, notes, and snippets.

@kierdavis
Created June 6, 2016 02:34
Show Gist options
  • Save kierdavis/ab680f2914593efed13486e7bb1e3924 to your computer and use it in GitHub Desktop.
Save kierdavis/ab680f2914593efed13486e7bb1e3924 to your computer and use it in GitHub Desktop.
type
MyObject = object
case kind: int # This defines a new field called 'kind' of type 'int'. Additionally, the value of this field determines what other fields are present in the object.
of 1:
field1: Type1
of 2:
field2: Type2
of 3, 4:
field3: Type3
field4: Type4
else:
otherField: OtherType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment