Reputation: 109
def greet() {
println "Hello, Groovy!"
}
greet() // How to call this function dynamically?
Upvotes: 0
Views: 225
Reputation: 171194
Assuming you mean you want to call it by name:
def greet() {
println "Hello Groovy!"
}
def name = "greet"
"$name"()
Should work
Upvotes: 3