Last active
October 23, 2022 20:48
-
-
Save razmanugget/54b149cbb4085fbe0f16d8d021c61eca to your computer and use it in GitHub Desktop.
Basics #bools #mark #swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // MARK: - BOOLS | |
| // declaration - create but don't initialize | |
| var isOrange: Bool | |
| // create and initialize with an initial value | |
| var isApple = true | |
| // determine equality and assign value to constant -> false | |
| let guess = "dog" | |
| let dogEqualsCat = guess == "cat" | |
| // -> false | |
| let myAge = 30 | |
| let isTeenager = myAge >= 13 && myAge <= 19 | |
| // MARK: force a state change | |
| // use ! to switch state -> false | |
| var switchState = true | |
| switchState = !switchState |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment