I don't understand why this code is bad:
let n1 = int::from_str(line);
if n1 == 0
compiler complains:
3.rs:7:12: 7:13 error: mismatched types: expected
`core::option::Optionint
` but found `VI0` (expected enum core::option::Option but found integral
varia
ble)
3.rs:7if n1 == 0
On Sat, May 18, 2013 at 11:46 AM, Renato Lenzi rex...@gmail.com wrote:
I don't understand why this code is bad:
let n1 = int::from_str(line);
if n1 == 0
compiler complains:
3.rs:7:12: 7:13 error: mismatched types: expected
`core::option::Optionint
` but found `VI0` (expected
On Sat, May 18, 2013 at 11:57 AM, Corey Richardson co...@octayn.net wrote:
```
match int::from_str(line) {
Some(x) = n1 = x,
None = { /* handle error... */}
}
if n1 == 0 {
...
```
Amend that to:
let n1;
match int::from_str(line) {
Some(x) = n1 = x,
None = { /* handle