From the course: Programming for Non-programmers: iOS 17 and Swift 5

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Using conditional statements and Booleans

Using conditional statements and Booleans

- [Instructor] Now let's get some practice writing a conditional statement inside of a playground. Remember, you can create the playground by going to file new and choosing playground. Once you've done that, hit the run button and then you should see the output over on the right. Let's go down a few lines and type the word "if". Remember, this is what we do to create a conditional statement and then we need something that is evaluated as true or false called a condition. So let's see if greeting is equal to something else. So type greeting, as you start typing it, just use the code hinting and press return and then space and two equal signs. Remember two equal signs is the comparison operator. We're checking to see if one value is equal to another value. That's different from the assignment operator, which is one equal sign that we see here on line three. So let's just copy and paste this string on line three including the double quotes, and then I'm going to paste it after the double…

Contents