Closures and Switch Statements

Learn about closures and switch statements in Groovy.

We'll cover the following


A closure is a block of code in Groovy, which may or may not take parameters and return a value. It is very similar to lambda expressions in Java 8. For example, in the above code it.size() <= 4 and println it are closures.

Get hands-on with 1200+ tech skills courses.