I want my program to do different things depending on whether user input is a number, a string of only letters, and so on. So I try to make some sort of switch statement. But of course I want it to look really succinct and perly.
I could do
or, using the fancy new switch feature,
Altho the given-when thing is cool, it would be cooler if the given() could be left out. It seems like the kind of thing that should be possible, because it's kind of, well, a given. Apparently it can be left out in a for() loop, but not in while(). And you can't use a for() loop in this case. Or can you?
And, by the way, is there an even shorter way to do