Feature Request: If with pattern match
Gekctek opened this issue · comments
Current capabilities for pattern matching usage where i want to do something if the thing matches and skip if it doesnt. This would be code sugar because a switch statement works just fine, but is clunky and makes reading the code hard for such a simple task.
let value : ?MyType = ...;
switch (value) {
case (null) { // skip };
case (?v) { // use v };
};
// rest of code
The let-else wont work because I want to just skip it if is null, not end execution
Something like this:
if (value is ?v) {
// Use v
}