Learn to Code via Tutorials on Repl.it!

← Back to all posts
Learning Swift
TheGM1

Hello guys, I thought while I was learning swift, I should share with others! I will be constantly updating this tutorial, and please feel free to ask any questions!

Voters
rogerioftn
Pcat1
hg0428
TheGM1
Comments
hotnewtop
ZaydSalahuddin

Hey do you know how to do inputs? For a project I have to input the price and it has to output the 18% tip of that.

TheGM1

@ZaydSalahuddin
Hi, to do inputs you must declare a variable and assign the value as readLine()

print("Enter your favorite programming language:")
let name = readLine()

print("Your favorite programming language is (name!).")

For more info goto:https://www.programiz.com/swift-programming/basic-input-output