<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>control flow | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/control-flow/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Mon, 21 Dec 2020 16:01:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>control flow | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>I added an if and switch tutorial</title>
		<link>https://learncgames.com/i-added-an-if-and-switch-tutorial/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=i-added-an-if-and-switch-tutorial</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Wed, 23 Dec 2020 00:00:16 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[control flow]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2138</guid>

					<description><![CDATA[<p>The next tutorial is Simple control flow in C. This demonstrates how to do if, if else and then switch statements. These are pretty siomple concepts but they are fundamentals so you do need to know them. One thing I didin&#8217;t show in the switch tutorial is that you can mix in labels for that [&#8230;]</p>
The post <a href="https://learncgames.com/i-added-an-if-and-switch-tutorial/">I added an if and switch tutorial</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:306,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/mohamed_hassan-5229782\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3679814&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205100023\/https:\/\/pixabay.com\/users\/mohamed_hassan-5229782\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 13:43:54&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-17 07:05:54&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-06 04:19:07&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 17:23:49&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-01 16:41:37&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-05 19:30:17&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-15 09:30:26&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-15 09:30:26&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:307,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3679814&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205102120\/https:\/\/pixabay.com\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 13:43:56&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-17 07:05:54&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-06 04:19:06&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 17:23:49&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-01 16:41:37&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-05 19:30:17&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-15 09:30:25&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-15 09:30:25&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_2139" aria-describedby="caption-attachment-2139" style="width: 300px" class="wp-caption alignleft"><img fetchpriority="high" decoding="async" class="size-medium wp-image-2139" src="https://learncgames.com/wp-content/uploads/2020/12/teacher-3679814_640-300x201.jpg" alt="Teachjer and blackboard" width="300" height="201" srcset="https://learncgames.com/wp-content/uploads/2020/12/teacher-3679814_640-300x201.jpg 300w, https://learncgames.com/wp-content/uploads/2020/12/teacher-3679814_640.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-2139" class="wp-caption-text">Image by <a href="https://pixabay.com/users/mohamed_hassan-5229782/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3679814">mohamed Hassan</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3679814">Pixabay</a></figcaption></figure>
<p>The next tutorial is <a title="Link to C Tutorial ten on control flow" href="https://learncgames.com/simple-control-flow-in-c" target="_blank" rel="nofollow noopener">Simple control flow in C</a>. This demonstrates how to do if, if else and then switch statements. These are pretty siomple concepts but they are fundamentals so you do need to know them.</p>
<p>One thing I didin&#8217;t show in the switch tutorial is that you can mix in labels for that real write-only code experience. It&#8217;s not a technique I recvommend which is why its NOT in the tutorial but if you promise never to use this except in the rarest of circumstances, here&#8217;s what I mean.</p>
<pre><code class="language-c" data-line="">#include &lt;stdio.h&gt;

int main() {
	int a = 10;
	switch (a) {
	case 1:
	case 2:
	case 3:
	case 4:
	{
		printf(&quot;a&lt;5\n&quot;);
		break;
	};
	case 5:
fred:
	case 6:
		printf(&quot;a ==5 or a ==6\n&quot;);
		break;
	case 7:
	case 8:
	case 9:
		printf(&quot;a &lt;9\n&quot;);
	case 10:
	{
		printf(&quot;a=10\n&quot;);
		goto fred;
	}
	default:
		printf(&quot;a not in range 1-10\n&quot;);
		break;
	}
}</code></pre>
<p>The label is the line <strong>fred:</strong> and you can see in case 10 that after printing &#8220;a=10\n&#8221;, it jumps to fred which is just after the 5 case. That does nothing and falls through to the 6 case where it prints out &#8220;a ==5 or a ==6\n&#8221;. It&#8217;s not recommended but at least now if you ever see a jump to a label in a switch statement you can be sure that the programmer was not really at the top of his or her game.</p>The post <a href="https://learncgames.com/i-added-an-if-and-switch-tutorial/">I added an if and switch tutorial</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2138</post-id>	</item>
	</channel>
</rss>
