| ▲ | ai_ 4 days ago | |
if let makes a lot more sense when you learn that a normal let expression also takes a pattern[1].
But this is intended for "exhaustive patterns". If you can't express an exhaustive pattern, like with an Option, then you can use let ... else
if let is just an extension of this "let pattern" system.Once you internalize how patterns work (and they really work everywhere) it all starts to really make sense and feels a lot cleaner. | ||