checkpoint 1: just want to make sure my logic is correct.

``````let c = 25.0
let f = Int(c) * 9 / 5 + 32
print("Celsisus: \(c)° + Fahrenheit: \(f)° "``````

I created a contsant for holding 25.0 the temp in celsius. I then created another contsant for holding the converted celsius to fahrenheit. Lastly printed the values respectively.

Thank you!

1

Welcome to HackingWithSwift forums.

+1 for formatted code!

Here are some comments I might share with a junior developer during a code review.

1. Why do you define c as a Double, but f is in Integer ? This seems inconsistent.
2. Consider using full words for your variables instead of c and f.
3. Because f is an integer, you may be losing accuracy when you convert c and do maths. Are you ok with losing accuracy?
4. Your print statement is incomplete. Missing a closing parenthesis. This may be cut/paste error.
5. Consider replacing the + sign with an = sign in your print statement. Also, chak ur spalling.
6. +1 for including degree symbols! Nice touch.

But wait, you say, c and f are common abbreviations for centigrade and fahrenheit. In this case, not a big deal. But many development teams might ask you to consider full word names for your variables. If you have a long name such as temperatureInCelsius, that's a lot to type compared with a simple "c". XCode is great in this regard, because your variables will benefit from code completion. But future you will thank past you for being more verbose. YMMV.

Also take a few moments to read many of the older posts. There are some great nuggets in older messages.

2

``````let celsius = 25.0
let fahrenheit = celsius * 9 / 5 + 32
print("The current temperature is \(celsius)°C =  \(fahrenheit)°F.")``````

Thank you for the feedback! So... I removed the Int. I created two constants. One with a double, and the second using the first, using operators. Then used string interpolation to return a full sentence with correct spelling.

1

SPONSORED Spend less time managing in-app purchase infrastructure so you can focus on building your app. RevenueCat gives everything you need to easily implement, manage, and analyze in-app purchases and subscriptions without managing servers or writing backend code.

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