<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Problem with methods</title>
		<link>http://rbwhitaker.wikidot.com/forum/t-425450/problem-with-methods</link>
		<description>Posts in the discussion thread &quot;Problem with methods&quot;</description>
				<copyright></copyright>
		<lastBuildDate>Fri, 06 Mar 2026 11:34:01 +0000</lastBuildDate>
		
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-425450#post-1339339</guid>
				<title>(no title)</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-425450/problem-with-methods#post-1339339</link>
				<description></description>
				<pubDate>Sat, 31 Dec 2011 21:01:16 +0000</pubDate>
				<wikidot:authorName>Rewiinded</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>No problem, thank you for your swift response.</p> <p>And once again, thanks a lot for this tutorial, it is great!</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-425450#post-1339202</guid>
				<title>Re: Problem with methods</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-425450/problem-with-methods#post-1339202</link>
				<description></description>
				<pubDate>Sat, 31 Dec 2011 16:50:46 +0000</pubDate>
				<wikidot:authorName>rbwhitaker</wikidot:authorName>				<wikidot:authorUserId>88099</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>At first I ran your code and I thought, &quot;What the crap? This isn't printing out anything! What on earth is going on? Then, suddenly, it hit me. Your program starts in the <em>Main</em> method, and only does what it runs into there. You don't have anything in your <em>Main</em> method, so the program just ends. You need to add this line to your <em>Main</em> method:</p> <div class="code"> <div class="hl-main"> <pre><span class="hl-identifier">Count</span><span class="hl-brackets">(</span><span class="hl-number">10</span><span class="hl-brackets">)</span><span class="hl-code">;</span></pre></div> </div> <p>So the full code should look something like this:</p> <div class="code"> <div class="hl-main"> <pre><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">System</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">Collections</span><span class="hl-code">.</span><span class="hl-identifier">Generic</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">Linq</span><span class="hl-code">; </span><span class="hl-identifier">using</span><span class="hl-code"> </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">Text</span><span class="hl-code">; </span><span class="hl-identifier">namespace</span><span class="hl-code"> </span><span class="hl-identifier">ConsoleApplication1</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-reserved">class</span><span class="hl-code"> </span><span class="hl-identifier">Program</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-types">static</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">Main</span><span class="hl-brackets">(</span><span class="hl-identifier">string</span><span class="hl-brackets">[]</span><span class="hl-code"> </span><span class="hl-identifier">args</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">Count</span><span class="hl-brackets">(</span><span class="hl-number">10</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-types">static</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">Count</span><span class="hl-brackets">(</span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">numberToCountTo</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-reserved">for</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">current</span><span class="hl-code"> = </span><span class="hl-number">1</span><span class="hl-code">; </span><span class="hl-identifier">current</span><span class="hl-code"> &lt;= </span><span class="hl-identifier">numberToCountTo</span><span class="hl-code">; </span><span class="hl-identifier">current</span><span class="hl-code">++</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">Console</span><span class="hl-code">.</span><span class="hl-identifier">WriteLine</span><span class="hl-brackets">(</span><span class="hl-identifier">current</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-brackets">}</span></pre></div> </div> <p>So I looked back at the tutorial, and sure enough, it kind of leaves you hanging right at the spot where you got stuck. It gives you the code, and then explains it, and it's not until a couple of paragraphs later, it shows you how to call the method, as I've done here in this reply.</p> <p>I seriously doubt you're the first person to run into this problem&#8212;just the first one to report it.</p> <p>I've tweaked the tutorial to make it obvious that the code won't do anything yet at that particular point in the tutorial, so it should be much better now for people who come along after this.</p> <p>Thanks for pointing out the problem!</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://rbwhitaker.wikidot.com/forum/t-425450#post-1339105</guid>
				<title>Problem with methods</title>
				<link>http://rbwhitaker.wikidot.com/forum/t-425450/problem-with-methods#post-1339105</link>
				<description></description>
				<pubDate>Sat, 31 Dec 2011 13:42:33 +0000</pubDate>
				<wikidot:authorName>Rewiinded</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Hello all, first of all: Thank you for these magnificent tutorials. The C# has been helping me a lot.</p> <p>However, when I arrived at the tutorial about methods I noticed that the programs wouldn't run properly. Is this a problem in my settings or a problem with the code?</p> <p>This code for example only gives me a &quot;press any key to continue&quot; message when executed. (I got the method directly from the tutorial)</p> <div class="code"> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { } static void Count(int numberToCountTo) { for (int current = 1; current &lt;= numberToCountTo; current++) { Console.WriteLine(current); } } } }</code></pre></div> <p>If you have any idea on how to fix this I'd be very grateful!</p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>