Created
June 3, 2022 23:02
-
-
Save boraseoksoon/192779cb192c2fb197807e3146a7cba8 to your computer and use it in GitHub Desktop.
if case let
This file contains hidden or 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
indirect enum List<T> { | |
case empty | |
case node(T, List<T>) | |
var value: T? { | |
if case .node(let value, _) = self { | |
return value | |
} else { | |
return nil | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment