On 2013-12-11 00:21, Idan Arye wrote:
      if(int b=a.tryParse!int()){
          //some code that uses `b`
      }

if `a` is "0" we won't enter the then-clause even though we managed to
parse. This is why we don't have this `tryParse` function in D...

Not just that - how would you signal that a is an invalid value? Throw an exception?

A solution would be:

  if (Option!int b = a.tryParse!int) {
    // Use b in here.
  }

--
  Simen

Reply via email to