To ask a user for their name, age, favorite color, and if they like dogs in Swift, you can use the following code:
main.swift501 chars19 lines
The readLine()
function allows you to read user input from the console. Note that the user's input is stored as a String
type, so you may need to convert it to a different data type if necessary.
gistlibby LogSnag