Groovy web console

subscribe to the feed Subscribe
to this
site

Groovy length() method demo

Published 2 months ago by Yogi Bear
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def x = ""
def y = "/path/to"

if (x.length() != 0) {
    print "x is not empty\n"
} else {
    print "x is empty\n"
}

if (y.length() != 0) {
    print "y is not empty\n"
} else {
    print "y is empty\n"
}