More syntactically cleaner way to check if a something is an error from an error union

Currently you can write:

const result = createError();
if (result) |_| {} else |_| {
    // ...
}

Would be kind of funny if you could just drop the then-case of the if statement:

const result = createError();
if (result) else |_| {
    // ...
}

Personally I find the currently possibly way good too, it is a bit of visual noise that draws attention to the then branch that does nothing and makes it more likely to notice that the multiline scope is for the else not for the then.

1 Like