[prev in list] [next in list] [prev in thread] [next in thread] 

List:       groovy-user
Subject:    [groovy-user] Re: How to easily read from System.in?
From:       mzallocco <mzallocco () gmail ! com>
Date:       2014-02-06 2:54:24
Message-ID: 1391655264769-5718334.post () n5 ! nabble ! com
[Download RAW message or body]

You can do the following instead:

def input = {prompt->
  print prompt
  System.in.newReader().readLine()
}

def name = input("Your name: ")
def age = input("Your age: ").trim().toInteger()

etc.




--
View this message in context: \
http://groovy.329449.n5.nabble.com/How-to-easily-read-from-System-in-tp367942p5718334.html
 Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic