Adding the ?. null verification

via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 18 13:20:45 PDT 2014


On Wednesday, 18 June 2014 at 15:42:04 UTC, Etienne wrote:
>
> writeln(obj.member?.nested?.val);
>

Optional chaining in swift is meant to be used more like this:

if let v = ptr?.attr?.getobj?()?.attr? {
   writeln(v)
} else {
   writeln("oops?!")
}

(I don't think Maybe will look as good.)


More information about the Digitalmars-d mailing list