mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Explain potentially confusing string example.
Reported be @ElBaha
This commit is contained in:
parent
e5f2021202
commit
8a8cccd4b6
@ -207,14 +207,15 @@ let hi = "hi";
|
||||
let mut count = 0;
|
||||
|
||||
while count < 10 {
|
||||
println!("count: {}", count);
|
||||
println!("count is {}", count);
|
||||
count += 1;
|
||||
}
|
||||
~~~~
|
||||
|
||||
Although Rust can almost always infer the types of local variables, you
|
||||
can specify a variable's type by following it with a colon, then the type
|
||||
name. Static items, on the other hand, always require a type annotation.
|
||||
Although Rust can almost always infer the types of local variables, you can
|
||||
specify a variable's type by following it in the `let` with a colon, then the
|
||||
type name. Static items, on the other hand, always require a type annotation.
|
||||
|
||||
|
||||
~~~~
|
||||
static MONSTER_FACTOR: f64 = 57.8;
|
||||
|
Loading…
Reference in New Issue
Block a user