Details
Description
Reported by Guillaume on the groovy-dev mailing-list:
def m3(s) {
switch(s) {
case 'a': 'letter A'; break
case 'b': 'letter B'; break
default: 'Unknown letter'
}
}
assert m3('a') == 'letter A' &&
m3('b') == 'letter B' &&
m3('z') == 'Unknown letter'
I was expecting that m3('z') would return 'Unknown letter', as
switch/case is the last statement in the method, and that the value
returned by that switch would go through the default case.