cognitive-engineering-lab / rust-book

The Rust Programming Language: Experimental Edition
https://rust-book.cs.brown.edu
Other
509 stars 83 forks source link

Make X var mutable in Control Flow Quiz. #41

Closed midnadimple closed 1 year ago

midnadimple commented 1 year ago

The first question in the first quiz of the Control Flow page does not compile, since the variable is not mutable and there is no type annotation or value to infer the type. I added mutability to the variable and defined it to 0.

willcrichton commented 1 year ago

Rust doesn't actually require a mut modifier or a type annotation. You can see for yourself in the playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c4a0e8058e9417f0469b71c2afef4b65

midnadimple commented 1 year ago

OK. No problem then.