How will you require user input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How will you require user input

Asking for user input

5th Aug 2021, 10:52 PM
Ryan
Ryan - avatar
4 Answers
+ 3
You use the readLine() function, which will return an optional string. So, you also need to unwrap it using the bang operator '!'.
5th Aug 2021, 10:59 PM
ChaoticDawg
ChaoticDawg - avatar
+ 3
Calvin Thomas I don't think it actually is mentioned in the Swift course. The course is designed around building an iOS app and not so much a console app. It is also quite dated at this point as there is a much newer and updated version of Swift. Some of the code in the course is no longer valid for the newest version of Swift.
6th Aug 2021, 9:50 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
ChaoticDawg Oh, I'm sorry for that. I had thought that this was there in Swift.
6th Aug 2021, 10:26 PM
Calvin Thomas
Calvin Thomas - avatar
0
Khar Wonder I guess that this has been clearly mentioned in the course.
6th Aug 2021, 7:43 PM
Calvin Thomas
Calvin Thomas - avatar