Swift | Sololearn: Learn to code for FREE!

+1

Swift

Hello, can someone tell me what is code for input since I couldnt find myself? I need to enter something in program but I dont know what is the input code. Is it same as in objective c or? Thank you

1/14/2019 1:27:29 PM

Xneva87

4 Answers

New Answer

+2

let var = readLine() readLine returns an optional string. When calling it print ex. print(varname!) , include the ! to refrain it from being an optional. If you dont it will say optional(“valueofvar”) Hope this helps

+2

In comparison to other languages like C# and java it’s kind of similar, C++ is special, also is considered a high level language, swift not so much

+1

Thats a bit confusing I mean thanks for the explanation, but I still dont get it. Why is input so complicated in Swift, C++ is harder than swift and all what you have to do is to type cin>> and then you do input from the keyboard.

+1

Is it not in the tutorial?