Is it possible to declare the type of the variable in Rust for loops? -


c++ example:

for (long = 0; < 101; i++) {     //... } 

in rust tried:

for i: i64 in 1..100 {     // ... } 

i declare let i: i64 = var before loop i'd rather learn correct way doing this, resulted in

error: expected 1 of `@` or `in`, found `:`  --> src/main.rs:2:10   | 2 |     i: i64 in 1..100 {   |          ^ expected 1 of `@` or `in` here 

you can use integer suffix on 1 of literals you've used in range. type inference rest:

for in 1i64..101 {     println!("{}", i); } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -