3 ms·
Your ternary demo needs to be written thus for it to work: let ter_demo = if a.is_none() { 3 } else { 2 }; You can also often use pattern matching: l
by chrismorgan 13y ago
Your ternary demo needs to be written thus for it to work:
let ter_demo = if a.is_none() { 3 } else { 2 };
You can also often use pattern matching:
let ter_demo = match a { None => 3, _ => 2 };
- Ygg2 13y agoYeah, I wrote the example out of my head, so no surprises there. Thanks, though.