You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Unintuitively", Haxe cases are absolutely strict, so this can bite:
switch (x) {
case 1:
case 2: trace('1 or 2'); // nope, never fall through
}
And the documentation doesn't explain how to declare a case matching several values - though it is explained deeper in the pattern matching documentation.
Still it's a bit confusing: is it case 1, 2: or case 1 | 2:?
It would be nice for beginners to add something.
The text was updated successfully, but these errors were encountered:
We're talking about this page, right? It contains this sentence:
Case body expressions never "fall through", so the break keyword is not supported in Haxe.
I think we could add a link to or patterns page here. Would that be sufficient?
Still it's a bit confusing: is it case 1, 2: or case 1 | 2:?
It's the | :) AFAIK comma is from the times where there was no proper pattern matching. I don't think we'll remove it any time soon, but I think we pretend that it does not exist. :) (or is it documented anywhere?)
"Unintuitively", Haxe cases are absolutely strict, so this can bite:
And the documentation doesn't explain how to declare a case matching several values - though it is explained deeper in the pattern matching documentation.
Still it's a bit confusing: is it
case 1, 2:
orcase 1 | 2:
?It would be nice for beginners to add something.
The text was updated successfully, but these errors were encountered: