I want to specify the type of i in this for loop. Visual Studio Code tells me that the type in i32 but the number isn't that big so I'd like to change it to u8.
for i in 0..101 {
println!("{}", i);
}
I tried this:
for i: u8 in 0..101 {
println!("{}", i);
}
However, I get this error:
error: expected one of `@` or `|`, found `:`
--> src/main.rs:2:10
|
2 | for i: u8 in 0..101 {
| ^
| |
| expected one of `@` or `|`
| help: maybe write a path separator here: `::`
What is the right way to specify the type?