You know code block is not an expression. The reason to transform switch
expression to switch statement in closure is make switch expression appear
everywhere, e.g.
```
def process(String s) { "Hello, $s" }
def a = 6
def r = process(
switch (a) {
case 6 -> 'a'
default -> 'b'
}
)
assert 'Hello, a' == r
```
P.S. Java's text block looks smarter, but I still like Groovy's raw text
block. When we want to get same result of Java's text block, just call
`groovyText.stripIndent()`, which I think it's more flexible. ( My 2 cents )
Cheers,
Daniel.Sun
-----
Apache Groovy committer & PMC member
Blog: http://blog.sunlan.me
Twitter: @daniel_sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html