<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[The &quot;If &lt; &gt; Then&quot; Block]]></title><description><![CDATA[<p dir="auto"> </p>
<h2><a class="anchor-offset" name="prerequisite"></a>Prerequisite</h2>
<ul>
<li><a href="/topic/73/working-with-blocks">Working with Blocks</a></li>
</ul>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="description"></a>Description</h2>
<p dir="auto">The “If &lt;&gt; then” block is a <strong>C block</strong> in the <strong>control</strong> category.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ca0a4385-50ad-4e93-8690-6ac76394bce5.PNG" width="550" /><br />
 </p>
<h2><a class="anchor-offset" name="how-does-this-block-work"></a>How does this block work?</h2>
<p dir="auto">This block <strong>runs the blocks inside its mouth if the condition is true.</strong> If the condition is <strong>false</strong>, it <strong>ignores the blocks inside it</strong> and continues to the blocks below it.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/3431c75b-7251-4ae7-b713-0e0d4ca5ec2a.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
<h2><a class="anchor-offset" name="the-condition-is-checked-only-once"></a>The condition is checked only once</h2>
<p dir="auto">The “If &lt;&gt; then” block <strong>checks its condition only once</strong>.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b12fe4b6-d1c6-4b31-b376-8248da659230.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
<h2><a class="anchor-offset" name="nested-if-lt-gt-then-blocks"></a>Nested If &lt;&gt; then Blocks</h2>
<p dir="auto">If you put one “If &lt;&gt; then” block inside the other, they become <strong>“Nested”.</strong> <img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/058daa25-6d57-4bdd-a3c2-6a125d65a691.PNG" width="150" /></p>
<p dir="auto">You can <strong>use Nested “if &lt;&gt; then”</strong> blocks when you want <strong>to check another condition when the first condition turns out to be true.</strong></p>
<p dir="auto">For example, as shown below, the first “If” block checks if the sprite is touching the “Start” sprite or not. if it is “true” then the second “If” block checks if the “x-position” is greater than 10. The sprite will say “Game started” when both conditions are true.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/467095fd-794c-4309-9de9-c2fee841a11f.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="multiple-if-lt-gt-then-blocks"></a>Multiple If &lt;&gt; then Blocks</h2>
<p dir="auto">You can <strong>stack multiple “If &lt;&gt; then” blocks together to check multiple conditions</strong> at the same time.</p>
<p dir="auto">For Example, as shown below, if the score is less than or equal to “5”, the sprite will say “I’m sad”; if the score is greater than or equal to “10”, the sprite will say “I’m happy”.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/a47baca3-bb22-48b8-9fb7-0ea507098141.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
]]></description><link>https://forum.creaticode.com/topic/252/the-if-then-block</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 17:58:08 GMT</lastBuildDate><atom:link href="https://forum.creaticode.com/topic/252.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 03 Jul 2022 13:48:21 GMT</pubDate><ttl>60</ttl></channel></rss>