@[email protected] to Lemmy [email protected]English • 2 years agoI wishi.imgur.comimagemessage-square171fedilinkarrow-up1930
arrow-up1930imageI wishi.imgur.com@[email protected] to Lemmy [email protected]English • 2 years agomessage-square171fedilink
minus-square@[email protected]linkfedilinkEnglish69•edit-22 years agoWow. Amateur hour over here. There’s a much easier way to write this. A case select: select(number){ case 1: return false; case 2: return true; } And so on.
minus-squareroboticalinkfedilink13•edit-22 years agoDon’t forget that you can have fall-through cases, so you can simplify it even further: switch (number) { case 1: case 3: case 5: case 7: case 9: ...
Wow. Amateur hour over here. There’s a much easier way to write this.
A case select:
And so on.
Don’t forget that you can have fall-through cases, so you can simplify it even further:
Teach me