0

I'm new to Swift and Xcode. I couldn't figure out how to take user input in Swift playground. I'm trying to write Swift equivalent of the following Python code:

def greet():
  name = raw_input('What is your name?>')
  print "Hello ", name

Is it possible to get user input in Swift playground?

nhgrif
  • 61,578
  • 25
  • 134
  • 173
mgs
  • 2,621
  • 2
  • 19
  • 14
  • 1
    possible duplicate of [Input from the keyboard in command line application](http://stackoverflow.com/questions/24004776/input-from-the-keyboard-in-command-line-application) – Fjodr Jun 16 '15 at 13:30

1 Answers1

0

Just use the ask() method which is available on Pad playgrounds

Stefan
  • 5,203
  • 8
  • 27
  • 51