Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- NodeKind = enum
- nkInt, nkFloat
- Node = ref NodeObj
- NodeObj = object
- case kind: NodeKind
- of nkInt: intVal: int
- of nkFloat: floatVal: float
- let a: Node = Node(kind: nkInt, intVal: 2)
- echo a.intVal
- a.kind = nkFloat
- a.floatVal = 2.0
- echo a.floatVal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement