When I compile this code:
let n: u32 = 1;
println!("{} dice on the table", if n == 0 { "no more" } else { n });
The compiler gives me the error:
error[E0308]: if and else have incompatible types
--> src/main.rs:3:69
|
3 | println!("{} dice on the table", if n == 0 { "no more" } else { n });
| --------- ^ expected `&str`, found `u32`
| |
| expected because of this
What is the best way to solve the problem?