Skip to content

Instantly share code, notes, and snippets.

@akshitzaveri
Last active February 24, 2021 04:38
Show Gist options
  • Save akshitzaveri/afaee45f41c0c79b6cd202c45074d9d6 to your computer and use it in GitHub Desktop.
Save akshitzaveri/afaee45f41c0c79b6cd202c45074d9d6 to your computer and use it in GitHub Desktop.
enum Status {
case notStarted
case ongoing
case ended
}
enum Team {
case first
case second
}
struct Match {
let status: Status
let team: Team
}
let match = Match(status: .ongoing, team: .first)
switch (match.status, match.team) {
case (.notStarted, .first):
print("Not Started, first team")
case (.notStarted, .second):
print("Not Started, second team")
case (.ongoing, .first):
print("Ongoing, first team")
case (.ongoing, .second):
print("Ongoing, second team")
case (.ended, .first):
print("Ended, first team")
case (.ended, .second):
print("Ended, second team")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment