Advertisement
Guest User

Untitled

a guest
Oct 1st, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.29 KB | None | 0 0
  1. type
  2.   NodeKind = enum
  3.     nkInt, nkFloat
  4.  
  5.   Node = ref NodeObj
  6.   NodeObj = object
  7.     case kind: NodeKind
  8.     of nkInt: intVal: int
  9.     of nkFloat: floatVal: float
  10.  
  11.  
  12. let a: Node = Node(kind: nkInt, intVal: 2)
  13. echo a.intVal
  14. a.kind = nkFloat
  15.  
  16. a.floatVal = 2.0
  17. echo a.floatVal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement