<?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: SameerQaisar17</title>
    <description>The latest articles on DEV Community by SameerQaisar17 (@sameerqaisar17).</description>
    <link>https://dev.to/sameerqaisar17</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4121118%2Ff750c0c3-9b33-4a7d-838d-4beebf83a76b.png</url>
      <title>DEV Community: SameerQaisar17</title>
      <link>https://dev.to/sameerqaisar17</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sameerqaisar17"/>
    <language>en</language>
    <item>
      <title>If-Else Statements: When I Finally Got It</title>
      <dc:creator>SameerQaisar17</dc:creator>
      <pubDate>Fri, 11 Sep 2026 16:15:58 +0000</pubDate>
      <link>https://dev.to/sameerqaisar17/if-else-statements-when-i-finally-got-it-3f8d</link>
      <guid>https://dev.to/sameerqaisar17/if-else-statements-when-i-finally-got-it-3f8d</guid>
      <description>&lt;h2&gt;
  
  
  📌 Quick Info
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Topic:&lt;/strong&gt; If-Else Statements in Python&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Target Audience:&lt;/strong&gt; Upper beginners who know basic Python&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Goal:&lt;/strong&gt; Help someone understand if-else in 5 minutes&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. Introduction
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"When I first started learning Python, I didn't understand why I needed if-else. I just wrote code that ran line by line. Then I wanted to build a program that made decisions — like checking if someone was old enough to vote. That's when I discovered if-else, and everything clicked."&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  2. The Problem (Without If-Else)
&lt;/h2&gt;

&lt;p&gt;Imagine you want to check if someone can vote:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;age=18
How do I check if they're old enough?
Without if-else, my code can't make this decision
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You can vote!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Too young to vote&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
You can vote!&lt;/p&gt;

&lt;h2&gt;
  
  
  5. What I Learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If-else lets my code make decisions&lt;/li&gt;
&lt;li&gt;The condition must be TRUE for the &lt;code&gt;if&lt;/code&gt; block to run&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;else&lt;/code&gt; block runs when the condition is FALSE&lt;/li&gt;
&lt;li&gt;I can use comparison operators: &lt;code&gt;&amp;gt;=&lt;/code&gt;, &lt;code&gt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;lt;=&lt;/code&gt;, &lt;code&gt;==&lt;/code&gt;, &lt;code&gt;!=&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Conclusion
&lt;/h2&gt;

&lt;p&gt;If-else seemed confusing at first. But once I practiced with simple examples like voting and marks, it became my favorite tool for building interactive programs.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
