Top 1,000 Features Creators Resources Blog Explorer Download
GitHub icon

Groovy

< >

Groovy is an open source programming language created in 2003 by James Strachan.

#69on PLDB 21Years Old 76kRepos

Try now: Riju ยท TIO

Apache Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform, is dynamically compiled to Java virtual machine (JVM) bytecode, and interoperates with other Java code and libraries. Read more on Wikipedia...


Example from Riju:
print "Hello, world!";
Example from hello-world:
println "Hello World"
// Hello World in Groovy println "Hello World"
Example from Linguist:
#!/usr/bin/env groovy println "Groovy!"
Example from Wikipedia:
class Bird implements FlyingAbility {} /* Adds the trait FlyingAbility to the Bird class capabilities */ def bird = new Bird() /* instantiate a new Bird */ assert bird.fly() == "I'm flying!" /* the Bird class automatically gets the behavior of the FlyingAbility trait */
Groovy Keywords
as assert break case catch class const continue def default do else enum extends false finally for goto if implements import in instanceof interface new null package return super switch this throw throws trait true try while

Language features

Feature Supported Token Example
Conditionals โœ“
Inheritance โœ“
Switch Statements โœ“
Functions โœ“
Exceptions โœ“
Constants โœ“
Classes โœ“
While Loops โœ“
Booleans โœ“ true false
Strings โœ“ "
"Hello world"
MultiLine Comments โœ“ /* */
/* A comment
*/
Print() Debugging โœ“ println
Comments โœ“
// A comment
Line Comments โœ“ //
// A comment
Operator Overloading โœ“
Semantic Indentation X

View source

- Build the next great programming language ยท About ยท Acknowledgements ยท Extensions ยท Day 625 ยท feedback@pldb.io