Is it not possible to get console user input in Swift?
2/21/2020 11:31:51 PM
for strings try this:
let n = readLine()!
for integers try this:
let n = Int(readLine()!)!
Sonic and Kylie Scott here is a quick code
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.
Google tells me to use readLine()
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
Alexandr thanks. What do the exclamation marks do after readLine()! and Int()! ?
Sonic without the exclamation it will display optional in the console
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?
GET THE FREE APP
Learn Playing. Play Learning
Send us a message