Skip to content

Instantly share code, notes, and snippets.

@cipolleschi
Last active January 7, 2021 09:02
Show Gist options
  • Select an option

  • Save cipolleschi/9c77c90e0b2b8203fd2bd89c7b10c7e8 to your computer and use it in GitHub Desktop.

Select an option

Save cipolleschi/9c77c90e0b2b8203fd2bd89c7b10c7e8 to your computer and use it in GitHub Desktop.
let myPet: Pet = .dog(breed: .siberianHusky)
switch myPet {
case .dog(let dog):
switch dog {
case .siberianHusky:
print("I have a Husky!")
case .germanSheperd:
print("I have a German Sheperd!")
}
case .cat(let cat):
switch cat {
case .siamese:
print("I have a Siamese Cat!")
case .abyssian:
print("I have an Abyssian Cat !")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment