Created
October 2, 2022 14:41
-
-
Save AhmedMenaim/e38dea96ac2ebde0f543e5490cfa0d3d to your computer and use it in GitHub Desktop.
Menaim Academy - Swift Course - Conditional Statements - Switch case
This file contains 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
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