Swift

From bibbleWiki
Jump to navigation Jump to search

Introduction

Here is my first dip into Apple and swift Swift Cheat Sheet

Data Types

Here we have the following Primatives

  • Int
  • Float
  • Double
  • Str
  • Bool

Control

If Statements

No surprises

if a < 4 {
  print("we are here 1")
}
else if a == 4 && a < 3 {
  print("we are here 2")
}
else {
  print("we are here 3")
}

Switch Statements

No surprises switch a {

  case "a":
     print("we are here a")
  case "b":
     print("we are here b")
  default:
     print("we are here not a or b")

}