Groovy is an open source programming language created in 2003 by James Strachan.
#64on PLDB | 21Years Old | 76kRepos |
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...
print "Hello, world!";
println "Hello World"
// Hello World in Groovy
println "Hello World"
#!/usr/bin/env groovy
println "Groovy!"
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 */
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
Feature | Supported | Example | Token |
---|---|---|---|
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 |