If match isn't ==, so what is it?
The Rust Programming Language Forum
If match isn't ==, so what is it?
Imagine I have a function like: fn get() -> Option<String> { Some("flower".to_string()) } If I try using something like: if Some(_) == get() { println!("something is here") } I'm getting error: error: in expressions, `_` can only be used on the left-hand side of an assignment --> /media/sandbox/read/main.rs:32:13 | 32 | if Some(_) == get() { | ^ `_` not allowed here However, if Some("car".to_string()) == get() { println!("car is here...
0 comments
No comments yet.