Created
May 7, 2023 14:53
-
-
Save o-nnerb/fa80e6ef7cd2a6519c92549b3d4b4152 to your computer and use it in GitHub Desktop.
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
func makeNoise(animal: Animal) { | |
switch animal { | |
case let dog as Dog: | |
print("The dog goes woof!") | |
case let cat as Cat: | |
print("The cat goes meow!") | |
case let bird as Bird: | |
print("The bird goes tweet!") | |
default: | |
print("Unknown animal!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment