4 ms·
It does, in fact the article you posted, shows you exactly when rust allows assignment in conditionals. As long as you're initializing a variable, it's allowed
by _3u10 5y ago
It does, in fact the article you posted, shows you exactly when rust allows assignment in conditionals.
As long as you're initializing a variable, it's allowed, if you're not initializing you'll have to use a block expression.
- capitainenemo 5y agoShould have just used this sentence - which also directly covers parent's case. "Rust does not allow assignment within simple expressions so they will fail to compile. This is done to prevent subtle errors with = being used instead of ==." Better?