<?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>goto | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/goto/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>Tue, 29 Dec 2020 10:15:46 +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>goto | 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>New tutorial on C loop statements published</title>
		<link>https://learncgames.com/new-tutorial-on-c-loop-statements-published/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=new-tutorial-on-c-loop-statements-published</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Tue, 29 Dec 2020 00:00:37 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[do-while]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[goto]]></category>
		<category><![CDATA[while]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2219</guid>

					<description><![CDATA[<p>There are four types of loop statements in C, for loops, while loops, do-while loops and goto statements. The first two are much more popular; In my Windows asteroids game, I used 54 for-loops, six while-loops, three do-while loops and no gotos. I found the same thing in Delphi and Turbo Pascal. The only difference [&#8230;]</p>
The post <a href="https://learncgames.com/new-tutorial-on-c-loop-statements-published/">New tutorial on C loop statements published</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;:288,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/1674061-1674061\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2416787&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:289,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2416787&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:30:52&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-11 00:55:09&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-27 12:27:21&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-04 10:10:12&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-11 07:13:03&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-24 17:30:46&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-30 12:16:23&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-03 10:35:49&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-15 09:30:11&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-21 03:47:58&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-21 03:47:58&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_2220" aria-describedby="caption-attachment-2220" style="width: 300px" class="wp-caption alignleft"><img fetchpriority="high" decoding="async" class="size-medium wp-image-2220" src="https://learncgames.com/wp-content/uploads/2020/12/mandala-loops-2416787_640-300x300.png" alt="Mandala loops" width="300" height="300" srcset="https://learncgames.com/wp-content/uploads/2020/12/mandala-loops-2416787_640-300x300.png 300w, https://learncgames.com/wp-content/uploads/2020/12/mandala-loops-2416787_640-150x150.png 150w, https://learncgames.com/wp-content/uploads/2020/12/mandala-loops-2416787_640.png 640w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-2220" class="wp-caption-text">Image by <a href="https://pixabay.com/users/1674061-1674061/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2416787">Renate Anna Becker</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2416787">Pixabay</a></figcaption></figure>
<p>There are four types of loop statements in C, <strong>for loops</strong>, <strong>while loops</strong>, <strong>do-while loops</strong> and <strong>goto statements</strong>. The first two are much more popular; In my Windows asteroids game, I used 54 for-loops, six while-loops, three do-while loops and no gotos.</p>
<p>I found the same thing in Delphi and Turbo Pascal. The only difference is that Pascal uses <strong>repeat .. until</strong> instead of <strong>do-while</strong> and I prefer <strong>repeat-until</strong>.  The logic is slightly clearer I feel as well. You repeat the body of the loop until a condition becomes true. In the C do-while statement, you repeat the body of the loop as long as the condition is true.</p>
<p>Anyway I&#8217;ve published <a title="Link to tutorial eleven on C loop statements" href="https://learncgames.com/tutorial-eleven-looping-in-c/" target="_blank" rel="nofollow noopener">tutorial eleven on C loop statements</a>. Have fun. I&#8217;ll get it added to the tutorials page shortly..</p>The post <a href="https://learncgames.com/new-tutorial-on-c-loop-statements-published/">New tutorial on C loop statements published</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">2219</post-id>	</item>
		<item>
		<title>Goto is considered bad programming in C but</title>
		<link>https://learncgames.com/goto-is-considered-bad-programming-in-c-but/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=goto-is-considered-bad-programming-in-c-but</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Mon, 15 Jun 2020 23:00:37 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[Techniques]]></category>
		<category><![CDATA[goto]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[nested]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=818</guid>

					<description><![CDATA[<p>There is one case for using goto when you have nested loops and you&#8217;d like to jump all the way out. The goto statement was very popular in BASIC but often resulted in programs being like spaghetti with gotos all over the place. Here&#8217;s a contrived example where I have used a goto. #include &#60;stdio.h&#62; [&#8230;]</p>
The post <a href="https://learncgames.com/goto-is-considered-bad-programming-in-c-but/">Goto is considered bad programming in C but</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="alignleft size-medium wp-image-819" src="https://learncgames.com/wp-content/uploads/2020/06/goto-sign-300x148.png" alt="goto exit sign" width="300" height="148" srcset="https://learncgames.com/wp-content/uploads/2020/06/goto-sign-300x148.png 300w, https://learncgames.com/wp-content/uploads/2020/06/goto-sign.png 504w" sizes="(max-width: 300px) 100vw, 300px" />There is one case for using goto when you have nested loops and you&#8217;d like to jump all the way out. The goto statement was very popular in BASIC but often resulted in programs being like spaghetti with gotos all over the place.</p>
<p>Here&#8217;s a contrived example where I have used a goto.</p>
<pre><code class="language-c" data-line="">#include &lt;stdio.h&gt; 

int array[10][10][10];
int main() {
    // Populate array
    for (int y=0;y&lt;10;y++)
      for (int x=0;x&lt;10;x++) 
        for (int z=0;z&lt;10;z++) {
          if (array[x][y][z]==0)
            goto exit;
    }
exit:;
}</code></pre>
<p>In my C programs, for-loops are the most popular followed by while-loops, do-while loops and gotos are hardly ever used at all.</p>The post <a href="https://learncgames.com/goto-is-considered-bad-programming-in-c-but/">Goto is considered bad programming in C but</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">818</post-id>	</item>
	</channel>
</rss>
