+ 3

Swift programming

How to get value from user in swift ? For example we use cin>> in c++

19th Aug 2018, 5:10 PM
Muneeb Khan
Muneeb Khan - avatar
1 Answer
+ 2
let name = readLine() The statement let name = readLine() waits for user input in the debug area. If you type "Swift" and press enter, the readLine function assigns that string to constant name and displays the output as Your favorite programming language is Swift. print("Please Enter your favorite programming language", terminator: ".") let name = readLine() print("Your favorite programming language is \(name!).")
19th Aug 2018, 5:18 PM
Alex “Rusack” Averin
Alex “Rusack” Averin - avatar