I'm reading The Rust Programming Language book and I stumbled upon a simple expression:
let guess: u32 = match guess.trim().parse() {
Ok(num) => num,
Err(_) => continue,
};
How does match
work with different kinds of expressions in its arms? E.g. the first arm would simply "return" num
so that it's assigned to guess
but in the second arm the expression is simply continue
. How does match
handle that and doesn't "assign" continue
to guess
but executes it? What happens with the whole assignment expression itself? Is it dropped from the call stack (if that's the correct term)?