Mut empty string error?


#1

Hi,
https://play.rust-lang.org/?gist=7107521bc0f515c5c6bd68b56458f67c&version=stable&mode=debug&edition=2015

vs

https://play.rust-lang.org/?gist=5b4bea7c3f72cc4e53c831d3377eb98a&version=stable&mode=debug&edition=2015

why?


#2

Because it’s not mutable and you’re trying to change it. The compiler specifically tells you this: “cannot assign twice to immutable variable”.