<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kass M</title>
    <description>The latest articles on DEV Community by Kass M (@kassmoreno).</description>
    <link>https://dev.to/kassmoreno</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F976071%2Fbd5088bc-9e0c-433e-8364-5dcea7b3cfc6.jpeg</url>
      <title>DEV Community: Kass M</title>
      <link>https://dev.to/kassmoreno</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kassmoreno"/>
    <language>en</language>
    <item>
      <title>Switch to Switch Statement?</title>
      <dc:creator>Kass M</dc:creator>
      <pubDate>Sun, 20 Nov 2022 22:07:04 +0000</pubDate>
      <link>https://dev.to/kassmoreno/why-switch-to-switch-statement-4eoi</link>
      <guid>https://dev.to/kassmoreno/why-switch-to-switch-statement-4eoi</guid>
      <description>&lt;p&gt;*&lt;em&gt;Not-so-fun fact: &lt;br&gt;
You CAN NOT use logical operators in the switch case statements.&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A switch statement can be seen as an alternative to an if-else statement. Comparing switch-case and if-else statements, their differences only show when dealing with a large set of selections; in these cases, the switch statements will prove to have faster processing power due to their fixed depth structure. Switch statements are also easier to debug and maintain. Though switch statements can get lengthy, their fixed depth makes it easy to spot and manipulate problem areas.&lt;/p&gt;

&lt;p&gt;For example: If you want to change the wake-up time for Thursday in the code below, you would have to restructure the if-else statement slightly.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6ktums8arfpp4auf8ql.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6ktums8arfpp4auf8ql.png" alt="Image description" width="646" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But, when dealing with a switch statement, you would only need to locate the "Thursday" case and make the immediate change.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2lqka6qusq5l99eerto4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2lqka6qusq5l99eerto4.png" alt="Image description" width="282" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When deciding between if-else and switch-case, always consider how many options you will be working with, if changes in the code might be necessary over time, and how fast you need the processing speed to be.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Bonus Fact!&lt;br&gt;
Once your switch statement finds its match case, it will print out everything from there and down unless a break is indicated.&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
No breaks:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6w5i0xi2sfw6bpt30dar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6w5i0xi2sfw6bpt30dar.png" alt="Image description" width="524" height="448"&gt;&lt;/a&gt;&lt;br&gt;
Breaks:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9rrbm8x4ov24qcghfevo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9rrbm8x4ov24qcghfevo.png" alt="Image description" width="486" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;--Thank you for reading my first post! Feel free to comment and follow. I'm here to learn just as much as I am here to share my findings through my journey to becoming a software engineer.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
  </channel>
</rss>
