In the example with variants, `Node(kind: op, leftOp: left.value[0], rightOp: 
right.value[0])], "")` is valid only if `op` is `nkAdd` or `nkSub`. However, 
Nim doesn't know if that's the case. You can solve it by using a `case` 
statement/expression:
    
    
    case op
    of nkAdd, nkSub:
      # here you can safely construct the object
    else:
      # do something else
    
    
    Run

Reply via email to