Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with a conditional statement in Swift. I can'tfigure out how to make the output differ based on user input. Ihave the code

I need help with a conditional statement in Swift. I can'tfigure out how to make the output differ based on user input. Ihave the code In question down below. Any help is appreciated.

print("what are 3 of your favorite movies?")

let movies = readLine()

print(" So your three favorite films are(movies)?" )

print("How old are you?")

let name = readLine()

var solution:Int?

if solution != nil {

print("you are an adult.")

} else {

print( "you are young.")

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

It looks like you are trying to ask the user for their favorite movies and age and then print a stat... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals of Financial Accounting

Authors: Fred Phillips, Robert Libby, Patricia Libby

5th edition

78025915, 978-1259115400, 1259115402, 978-0078025914

More Books

Students also viewed these Programming questions

Question

What is a sales volume variance?

Answered: 1 week ago