Updated for Xcode 14.2
You already know enough to start writing your first useful code, albeit fairly simple: we’re going to convert temperatures from Celsius to Fahrenheit.
Your goal is to write a Swift playground that:
You already know everything you need to solve that problem, but if you’d like some hints then I’ll add some below.
Hacking with Swift+ subscribers can get a complete video solution for this checkpoint here: Solution to Checkpoint 1. If you don’t already subscribe, you can start a free trial today.
Note: I really do encourage you to try building this playground before reading any hints or trying my solution. I know it might seem simple, but the course does start to get harder soon and it’s important to be sure you’ve learned all the fundamentals.
Please go ahead and try building the playground now.
Still here? Okay, here are some hints:
let
to make your constant. You can call it whatever you want, but I think celsius
would be an appropriate name.*
for multiplication and /
for division.\(someVariable)
to activate string interpolation.print()
, you can use Option+Shift+8 to get the degrees symbol: °. This means you can write something like 25°F.SPONSORED From March 20th to 26th, you can join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer!
Sponsor Hacking with Swift and reach the world's largest Swift community!
Link copied to your pasteboard.