Read from STDIN in Groovy

print "What is your name? "
def name = System.in.newReader().readLine()
println "Your name is " + name
Exmaple:
$ groovy hello.goovy

What is your name? Goyun
Your name is Goyun

Comments

Popular posts from this blog