Less than in Groovy case/switch statement
Posted
by UltraVi01
on Stack Overflow
See other posts from Stack Overflow
or by UltraVi01
Published on 2010-05-05T05:02:01Z
Indexed on
2010/05/05
5:08 UTC
Read the original article
Hit count: 195
groovy
I have the following switch statement
switch (points) {
case 0: name = "new"; break;
case 1..14: badgeName = "bronze-coin"; break;
case 15..29: badgeName = "silver-coin"; break;
default: badgeName = "ruby";
}
I'd like the first case (case 0) to include points less than or equal to 0. How can I do this in Groovy?
© Stack Overflow or respective owner