Well it's not overly complicated to make simpler. One issue is didnt use 
`isSome` or `isNone` for the if. There are also utility modules such as 
[optionsutils](https://github.com/PMunch/nim-optionsutils) to make it safer and 
easier to work with. 
    
    
    import std/options
    converter toOpt[T](t: T): Option[T] = some(t)
    var abc: Option[string]
    
    if abc.isNone:
      abc = "test"
    assert abc.get == "test"
    
    
    Run

Reply via email to