3 Cool new features of Swift 5.9
<h2>01. Using if and switch as expressions</h2>
<p>Until Swift 5.9, the keywords <strong>if</strong> and <strong>switch</strong> could only be used as statements.</p>
<p>This meant that it wasn’t possible to directly assign the result of an <strong>if</strong> or a <strong>switch</strong> to a variable or to pass it as an argument.</p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:700/1*wCH9zA6oUc0Aa8EYYzlStg.png" style="height:198px; width:700px" /></p>
<p><strong>if</strong> and <strong>switch</strong> can now be used as expressions!</p>
<p>This means that these awful nested ternary expressions can now be replaced by much more readable <strong>if</strong> conditions:</p>
<p><a href="https://medium.com/@sagar.ajudiya/cool-new-features-of-swift-5-9-71c4cc3b079c"><strong>Website</strong></a></p>