Skip to content

Instantly share code, notes, and snippets.

@razmanugget
Last active October 23, 2022 20:48
Show Gist options
  • Select an option

  • Save razmanugget/54b149cbb4085fbe0f16d8d021c61eca to your computer and use it in GitHub Desktop.

Select an option

Save razmanugget/54b149cbb4085fbe0f16d8d021c61eca to your computer and use it in GitHub Desktop.
Basics #bools #mark #swift
// 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