문서의 이전 판입니다!
isCase()
구현체 아무것이나 와도 된다. 1..10
형태의 Range도 isCase()를 구현하고 있다.class CaseCategory { static boolean isCase(Closure casePredicate, Object switchParameter) { casePredicate.call switchParameter } } use (CaseCategory) { switch (param) { case { it % 2 == 0 } : return 'even' case { it % 3 == 0 } : return 'threeven' case { 0 < it } : return 'positive' default : return 'negative' } }