+ 1
How to ask for input in Swift?
How can I ask for a user to input something in Swift? Like cin in C++
4 odpowiedzi
+ 2
Try this:
let name = readLine()
print("Your name is \(name!).")
+ 1
That's weird, in my case it worked without problems.
0
Almost works, readLine() is asking for input, but name is kept as nil.
0
Could you please post a link to a playground code using this? I could be overlooking something.