Groovy web console

subscribe to the feed Subscribe
to this
site

asd

Published 1 month ago by asdasd with tags sasd
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def say(msg = 'Hello', name = 'world') {    "$msg $name!"
}
 
// We can invoke 3 signatures:
// say(), say(msg), say(msg, name)
assert 'Hello world!' == say()
// Right most parameter with default value is eliminated first.
assert 'Hi world!' == say('Hi')
assert 'Howdy, mrhaki!' == say('Howdy,', 'mrhaki')