3 ms·
Behold: switch (true) { case a > b: ... case isFullMoon(): ... }
by aasasd 7y ago
Behold:
switch (true) {
case a > b: ...
case isFullMoon(): ...
}
- codr7 7y agoThanks, I have yet to come across anything that P6 doesn't have a feature for. The languages [0] I've designed so far don't even come close in complexity, and I'm still balancing the edge of my abilities to keep track of everything. If they manage to make that monster run reasonably correct and fast, I'm seriously impressed. [0] https://github.com/codr7/g-fu/tree/master/v1 https://github.com/codr7/g-fu/tree/master/v1
- aasasd 7y agoWell, that's not specifically Perl above―it should work in most languages with `switch`. It's also highly questionable to my taste, as I don't see why `if` wouldn't do. I've chastised a dude many a time for its use, but that was only one of his dubious choices in life, so...