Does the Swift tutorial here not have a section on getting console user input? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Does the Swift tutorial here not have a section on getting console user input?

Is it not possible to get console user input in Swift?

21st Feb 2020, 11:31 PM
Sonic
Sonic - avatar
9 Answers
22nd Feb 2020, 12:10 AM
BroFar
BroFar - avatar
+ 6
Yes I just reviewed that the input lesson was not available... strange but true unless I missed it. Generally yes the app is usually complete and laid out.
22nd Feb 2020, 2:51 AM
BroFar
BroFar - avatar
+ 5
ive been having this issue as well, ive used readline but then the compiler would yell at me when i try to manipulate or do whatever with the input
21st Feb 2020, 11:59 PM
Kylie
Kylie - avatar
+ 4
Google tells me to use readLine()
21st Feb 2020, 11:35 PM
Sonic
Sonic - avatar
+ 4
Alexandr thanks. What do the exclamation marks do after readLine()! and Int()! ?
22nd Feb 2020, 2:11 AM
Sonic
Sonic - avatar
+ 4
Sonic without the exclamation it will display optional in the console
22nd Feb 2020, 2:12 AM
BroFar
BroFar - avatar
+ 4
Am I right in observing that this information is not available in the Sololearn Swift tutorial? Is it because console user input is not a major part of Swift?
22nd Feb 2020, 2:42 AM
Sonic
Sonic - avatar
+ 3
BroFar thanks.
22nd Feb 2020, 2:10 AM
Sonic
Sonic - avatar
+ 2
For int use Int(readLine()!)!
1st Apr 2020, 6:15 AM
Paul K Sadler
Paul K Sadler - avatar