About the Groovy compiler
Dynamic JVM language, great for scripting. Compiled online. Run Groovy code in your browser with no install and no signup — the editor, the input and the output share one screen. Groovy is executed by a remote runtime: your code is submitted to it and the output is returned to this page.
Press Run to execute the program, edit it and press Run again, or paste your own code over it. Everything you type stays in the page; the editor caches your work locally so a reload does not lose it.
A Groovy example
This is the program the Groovy editor opens with — run it as it is, then change it.
def students = [
[name: "Alice", scores: [92, 88, 95]],
[name: "Bob", scores: [87, 91, 83]],
[name: "Charlie", scores: [95, 90, 98]],
[name: "Diana", scores: [78, 82, 75]],
]
def report = students.collect { s ->
def avg = (s.scores.sum() / s.scores.size()) as double
[name: s.name, average: Math.round(avg * 10) / 10]
}.sort { -it.average }
println "Student Report:"
println "-" * 40
report.eachWithIndex { s, i ->
printf " %d. %-10s %s%n", i + 1, s.name, s.average
}
def square = { it * it }
def evens = (1..10).findAll { it % 2 == 0 }.collect(square)
println "Even squares: $evens"
More JVM Languages compilers
Browse all 109 languages — the same editor runs each of them, in the browser or on a shared runner.