:nerd_face: if let is used along with single equal & not double equal
:bulb: if let zbc = xyz
:nerd_face: if let is an alternative to match & guard
// This enum purposely doesn't #[derive(PartialEq)],
// neither we implement PartialEq for it. That's why comparing Foo::Bar==a fails below.
enum Foo {Bar}
fn main() {
let a = Foo::Bar;
// Variable a matches Foo::Bar
if Foo::Bar == a {
// ^-- this causes a compile-time error. Use `if let` instead.
println!("a is foobar");
}
}
:nerd_face: if let is used along with single equal & not double equal :bulb:
if let zbc = xyz
:nerd_face:if let
is an alternative tomatch
&guard