4 ms·
Nah, in that example there should be a `return` before the `None` -- because it's the only block in the function it doesn't matter. But it's not a ternary oper
by Manishearth 9y ago
Nah, in that example there should be a `return` before the `None` -- because it's the only block in the function it doesn't matter.
But it's not a ternary operator, it's unary.
let val = foo.bar()?; will call `bar()`, return if it is None, and if it is `Some(foo)`, set `val` to `foo`.