BLACK FRIDAY SALE: Save 50% on all my Swift books and bundles! >>

DAY 5

Conditions


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.

  1. How to check a condition is true or false
  2. How to check multiple conditions
  3. How to use switch statements to check multiple conditions
  4. How to use the ternary conditional operator for quick tests

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.

Have some questions about operators and conditions?

Hit Send below to start a virtual conversation with me.

Share your progress!

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!

Need help? Tweet me @twostraws!

 

Hacking with Swift is sponsored by Guardsquare

SPONSORED AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP.

Learn more

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

100 Days of SwiftUI


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.

Back to 100 Days of SwiftUI

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.