How to take a user input valve in swift programming | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to take a user input valve in swift programming

Getting confused to do the above process

8th Sep 2019, 6:55 AM
Yash chitroda
Yash chitroda - avatar
1 Answer
+ 1
You can use the readLine function: inputString = readLine()! inputNumber = Int(readLine()!)! Initialize your variables first. You can change the type for your number inputs, and you can have multiple inputs on multiple lines. Each readLine will read a different input line. Also, in SoloLearn, this input is all done right at the beginning of the program.
8th Sep 2019, 10:32 PM
Benjamin