Groovy — Command Reference
The most used Groovy commands — each with an explanation, working example, and real-world usage. The language of Gradle build scripts and Jenkins pipelines.
7 categories · 16 commands
🖥️
Output
Printing to the screen and GString interpolation.
printlnString interpolation ( $ )📦
Variables & Types
def and type conversion.
defas Integer / toInteger()🔢
Numbers & Math
Operators and the Math class.
Math operatorsMath.sqrt() / Math.abs()✍️
String
Length, casing, searching, replacing, and splitting.
.length() / .toUpperCase().contains() / .replace().split()📚
List & Map
List and Map.
List (items)Map (dictionary)🔀
Condition & Loop
if/else, for, and while.
if / elsefor / eachwhile🧩
Function
Functions and closures with def.
def (function)Closure ( { -> } )