If there’s one line from Shakespeare’s Hamlet that most people know, it’s “to be or not to be, that is the question.” Shakespeare meant that as the ultimate question of life or death, but it just so happens that Hamlet strikes right at the heart of logic in programming: evaluating whether a condition is true or not.
Today we’re going to get into the real detail of Swift: operators and conditions, which let us evaluate our program’s state as it runs and take different action depending on the result. There are several ways of doing it and you’ll need them all, but we’ll walk through them step by step so you can see how they compare.
Today you have four tutorials to work through, where you’ll meet things like if
, switch
, and more. Once you’ve watched each video and optionally gone through the extra reading, there’s a short test to help make sure you’ve understood what was taught.
Do you remember the two rules of this series? You’re already being awesome at the first one because you keep coming back for more (you rock!), but don’t forget the second: post your progress online, so you can benefit from all the encouragement.
Hit Send below to start a virtual conversation with me.
Great job on finishing another day! If you still have questions about what you learned, please send them in using this form – I'll do my best to address the most common problems in the next course update. Thank you!
If you use Twitter, the button below will prepare a tweet saying you completed today, along with a celebratory graphic, the URL to this page, and the challenge hashtag. Don't worry – it won't be sent until you confirm on Twitter!
Alternatively, copy and paste the text below to your preferred social network - I'm @twostraws on Mastodon.social, Bluesky, and Threads.
🎉 I just finished Day 5 of the #100DaysOfSwiftUI at https://www.hackingwithswift.com/100/swiftui/5 via @twostraws
Need help? Tweet me @twostraws!
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's all new Paywall Editor allow you to remotely configure your paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
The 100 Days of SwiftUI is a free collection of videos, tutorials, tests, and more to help you learn SwiftUI faster. Click here to learn more, or watch the video below.
Link copied to your pasteboard.