Add hints to the variable bindings exercises

This commit is contained in:
Carol (Nichols || Goulding)
2015-09-17 19:16:30 -04:00
parent 9cf4958982
commit dbfab88e61
5 changed files with 151 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
// Make me compile!
// Make me compile! Scroll down for hints :)
fn main() {
let x;
@@ -8,3 +8,39 @@ fn main() {
println!("Not ten!");
}
}
// The compiler message is saying that Rust cannot infer the type that the
// variable binding `x` has with what is given here.
// What happens if you annotate line 4 with a type annotation?
// What if you give x a value?
// What if you do both?
// What type should x be, anyway?
// What if x is the same type as 10? What if it's a different type?