- Boolean Conditions: Rust requires conditions to be
bool
.
- No Implicit Type Conversion: Types are not implicitly converted in conditions.
- No Traditional
for
Loop: Rust's for
loop iterates over ranges or collections.
- No
do-while
Loop: Rust doesn't have a do-while
loop, but loop
can be used to achieve similar behavior.
- Pattern Matching with
match
: More powerful and safer than C's switch
.
- No Implicit Fall-Through: In
match
statements, each arm is independent.
- Error Handling Without Exceptions: Rust uses
Result
and Option
types for explicit error handling.
- Exhaustive
if
Expressions: Must cover all possible conditions when used as expressions.
- Variable Scope: Variables in Rust have stricter scoping rules, enhancing safety.
- No Implicit Variable Declaration: Variables must be declared before use, preventing accidental usage of undeclared variables.