UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Checkpoint 1: Is my logic correct?

Forums > 100 Days of SwiftUI

Hey, i have just started learning SwiftUI with you, and im wondering if from beginning i didn't made really big logical mistakes in here?

var greeting = "Hello, lets convert Celsius to Fahrenheit:"

let celsius = 23.0
let fahrenheit = celsius*9.0/5.0+32.0

print(greeting)

print("Your room temperature is \(celsius) \("°C")")
print("Your room temperature is \(fahrenheit) \("°F")")

   

@gorzkijay is running a temperature.

i'm wondering if from beginning i didn't I made really big logical mistakes

Try these two test cases with your code.

(1) Set the celsius value to zero degrees. We know the answer for fahrenheit should be about 32 degrees. (Water freezes.) (2) Set the celsius value to 100 degrees. We're pretty sure that water boils around 212 degrees fahrenheit, depending on your altitude above (or below) sea level.

If these test cases succeed, then WELL DONE.

Keep Coding!

+25 points to Ravenclaw for finding and using the degree character!

1      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.