Rust for JavaScript Developers – Functions and Control Flow
It&#x27;d be nice to mention that Rust has if expressions, not if statements.<p>Therefore the example could be simplified to:<p><pre><code>   fn calculate_tax(income: i32) -&gt; i32 {
     if income &lt; 10 {
       0
     } else if income &gt;= 10 &amp;&amp; income &lt; 50 {
       20
     } else {
       50
     }
   }</code></pre>