Skip to content

Instantly share code, notes, and snippets.

@Kametrixom
Last active September 3, 2015 07:03
Show Gist options
  • Save Kametrixom/437a607e16eacf08e9c1 to your computer and use it in GitHub Desktop.
Save Kametrixom/437a607e16eacf08e9c1 to your computer and use it in GitHub Desktop.
// Make this code compile without changing these lines
func raw<T: RawRepresentable>(t: T) -> T.RawValue {
return t.rawValue
}
let array : [E] = [.A(true), .B(1), .C("C")]
array.map(raw)
if case .C(let s?)? = array.first {}
// If you want a bigger challenge, include this part:
for elem in array {
switch elem {
case .C(_):
print("C!")
}
}
@Kametrixom
Copy link
Author

Congrats to @kostiakoval for solving the challenge when there wasn't an extended version yet
Congrats to @pyrtsa for solving the extended challenge ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment