Increment and Decrement
Note: Please read the comments in the code for explanation.
class GroovyTut {
static void main(String[] args) {
println("Hello World");
//comments can be added using "//" or "/* */"
def a = 1;
// prints the value of "a" and then increments it
println("a++ = " + (a++));
// increments the value of "b" then prints it
def b = 1;
println("++b = " + (++b));
// prints the value of "c" and then decrements it
def c = 1;
println("c-- = " + (c--));
// decrements the value of "d" then prints it
def d = 1;
println("--d = " + (--d));
}
}