3 ms·
On the other hand you can assign within expressions in Rust, and it's generally not been an issue that I've seen anyone complain about. However, that might be b
by Ar-Curunir 8y ago
On the other hand you can assign within expressions in Rust, and it's generally not been an issue that I've seen anyone complain about. However, that might be because the type checker usually catches you if you're making a mistake; assignment/variable binding return the type `()`, which doesn't work inside ifs or whiles
- sametmax 8y agoIn PHP, the "$a = 1" and "$a == 1" look a lot like each others. In rust, you would use "let a = " which removes the ambiguity.
- marcosdumay 8y agoThat's equivalent to the Python's (=) operator, that return None. What Python got now is a different (:=) operator, that behaves like the assignment in C.