Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AhmedMenaim/e38dea96ac2ebde0f543e5490cfa0d3d to your computer and use it in GitHub Desktop.
Save AhmedMenaim/e38dea96ac2ebde0f543e5490cfa0d3d to your computer and use it in GitHub Desktop.
Menaim Academy - Swift Course - Conditional Statements - Switch case
import Foundation
let number = 5
switch number { // if number
case 5: // number == 5
print("Done")
case 6: // else if number == 6
print("\(number) is done")
default: // else
print("Error")
}
let myString = "Menaim"
switch myString {
case "Ahmed":
print("Error")
case "Mohamed":
print("Mohammed")
default:
print("Menaim Academy")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment