<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Linux Format forums</title>
  <link>http://linuxformat.com/forums/index.php</link>
  <description>Help, discussion, magazine feedback and more</description>
  <language>english</language>
  <copyright>(c) Copyright Wed May 22, 2013 9:01 pm by Linux Format forums</copyright>
  <managingEditor>webmaster@linuxformat.com</managingEditor>
  <webMaster>webmaster@linuxformat.com</webMaster>
  <pubDate>Wed May 22, 2013 9:01 pm</pubDate>
  <lastBuildDate>Wed May 22, 2013 9:01 pm</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Linux Format forums</title>
    <url></url>
    <link>http://linuxformat.com/forums/</link>
    <description>Help, discussion, magazine feedback and more</description>
  </image>

                                      <item>
                                        <title>Re: Coding Academy - Unexpected Error Msg.</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=90553#90553</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=130'&gt;Ram&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Fri Jul 02, 2010 7:49 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Ready for project 3 now &lt;img src=&quot;images/smiles/icon_smile.gif&quot; alt=&quot;Smile&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Good luck.</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=90553#90553</comments>
                                        <author>Ram</author>
                                        <pubDate>Fri Jul 02, 2010 7:49 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=90553#90553</guid>
                                      </item>
                                      <item>
                                        <title>Re: Coding Academy - Unexpected Error Msg.</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=90538#90538</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=65997'&gt;chriswadams&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Thu Jul 01, 2010 11:11 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Aha!  &lt;img src=&quot;images/smiles/icon_biggrin.gif&quot; alt=&quot;Very Happy&quot; border=&quot;0&quot; /&gt;  What was missing was this code block:&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;foreach&amp;#40;string word in lines&amp;#41;&amp;#123;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if &amp;#40;word.Length &amp;lt; 3&amp;#41; continue;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if &amp;#40;word.Contains&amp;#40;&amp;quot;'&amp;quot;&amp;#41;&amp;#41; continue;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;WordList.Add&amp;#40;word.ToLower&amp;#40;&amp;#41;&amp;#41;; &lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
The way I had it, if I started the program with one argument, the program skipped right over the above code. By copying and pasting it like so:&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if &amp;#40;args.Length &amp;gt; 0&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;string&amp;#91;&amp;#93; lines = File.ReadAllLines&amp;#40;args&amp;#91;0&amp;#93;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;foreach&amp;#40;string word in lines&amp;#41;&amp;#123;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if &amp;#40;word.Length &amp;lt; 3&amp;#41; continue;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if &amp;#40;word.Contains&amp;#40;&amp;quot;'&amp;quot;&amp;#41;&amp;#41; continue;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;WordList.Add&amp;#40;word.ToLower&amp;#40;&amp;#41;&amp;#41;;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#125;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
the error message disappears, and the program accepts arguments like it should. Eureka!&lt;br /&gt;
&lt;br /&gt;
Thanks again for your time, Ram!&lt;br /&gt;
chriswadams</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=90538#90538</comments>
                                        <author>chriswadams</author>
                                        <pubDate>Thu Jul 01, 2010 11:11 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=90538#90538</guid>
                                      </item>
                                      <item>
                                        <title>Re: Coding Academy - Unexpected Error Msg.</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=90483#90483</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=130'&gt;Ram&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Jun 30, 2010 2:05 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      That because you have not told it what to do with with with the supplied file (args.Length &amp;gt; 0) &lt;br /&gt;
&lt;br /&gt;
It reads &lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&amp;#123;&lt;br /&gt;
if &amp;#40;args.Length &amp;gt; 0&amp;#41;&amp;#123;&lt;br /&gt;
string&amp;#91;&amp;#93; lines = File.ReadAllLines&amp;#40;args&amp;#91;0&amp;#93;&amp;#41;; &lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
Then skips to &lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;Console.WriteLine&amp;#40;&amp;quot;&amp;quot;&amp;#41;;&lt;br /&gt;
Console.WriteLine&amp;#40;&amp;quot;Welcome to WordScramble!&amp;quot;&amp;#41;;&lt;br /&gt;
Console.WriteLine&amp;#40;&amp;quot;Type !quit to exit, !letters for a reminder, or !next for a new word.&amp;quot;&amp;#41;;&lt;br /&gt;
Console.WriteLine&amp;#40;&amp;quot;&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
GetLetters&amp;#40;&amp;#41;;&lt;br /&gt;
Console.WriteLine&amp;#40;PromptLetters&amp;#41;;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
And the error is coming from GetLetters() as the word array is empty.&lt;br /&gt;
&lt;br /&gt;
I'll let you figure out what's missing &lt;img src=&quot;images/smiles/icon_smile.gif&quot; alt=&quot;Smile&quot; border=&quot;0&quot; /&gt;</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=90483#90483</comments>
                                        <author>Ram</author>
                                        <pubDate>Wed Jun 30, 2010 2:05 am</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=90483#90483</guid>
                                      </item>
                                      <item>
                                        <title>Re: Coding Academy - Unexpected Error Msg.</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=90481#90481</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=65997'&gt;chriswadams&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Jun 30, 2010 12:30 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Ram -&lt;br /&gt;
&lt;br /&gt;
You were right about the placement of the { . I moved it to the location you suggested and the error message disappeared. Thanks!&lt;br /&gt;
&lt;br /&gt;
However, I still have a question about launching a program with arguments.&lt;br /&gt;
&lt;br /&gt;
You wrote:&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Quote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;So to launch the program without any arguments do this&lt;br /&gt;
Code:&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;./wordscramble&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
To launch with 1 argument do this&lt;br /&gt;
Code:&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;./wordscramble mywordlist&amp;nbsp; &amp;nbsp;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
mywordlist would then be stored in (args[0])&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
So I changed my code from this:&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&amp;#123;&lt;br /&gt;
if &amp;#40;args.Length &amp;gt; 12&amp;#41;&amp;#123;&lt;br /&gt;
string&amp;#91;&amp;#93; lines = File.ReadAllLines&amp;#40;args&amp;#91;1&amp;#93;&amp;#41;;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
to this:&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&amp;#123;&lt;br /&gt;
if &amp;#40;args.Length &amp;gt; 0&amp;#41;&amp;#123;&lt;br /&gt;
string&amp;#91;&amp;#93; lines = File.ReadAllLines&amp;#40;args&amp;#91;0&amp;#93;&amp;#41;;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
but when I tried to launch the program with a single argument, I got this error message:&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Quote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;&lt;br /&gt;
Unhandled Exception: System.IndexOutOfRangeException: Array index is out of range.&lt;br /&gt;
at WordScramble.MainClass.Main (System.String[] args) [0x00000]&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
If the 1st argument is held in &amp;quot;args[0]&amp;quot; then why is the index out of range?&lt;br /&gt;
&lt;br /&gt;
Thanks again for your time,&lt;br /&gt;
chriswadams.</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=90481#90481</comments>
                                        <author>chriswadams</author>
                                        <pubDate>Wed Jun 30, 2010 12:30 am</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=90481#90481</guid>
                                      </item>
                                      <item>
                                        <title>Re: Coding Academy - Unexpected Error Msg.</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=90355#90355</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=130'&gt;Ram&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Fri Jun 25, 2010 8:39 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi Chris,&lt;br /&gt;
&lt;br /&gt;
Your placement of a { was in the wrong place. &lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
class MainClass&lt;br /&gt;
&amp;#123;&lt;br /&gt;
static List&amp;lt;string&amp;gt; WordList = new List&amp;lt;string&amp;gt;&amp;#40;&amp;#41;;&lt;br /&gt;
static List&amp;lt;string&amp;gt; UsedList = new List&amp;lt;string&amp;gt;&amp;#40;&amp;#41;;&lt;br /&gt;
static Random Rand = new Random&amp;#40;&amp;#41;;&lt;br /&gt;
static string PromptLetters;&lt;br /&gt;
//static string lines; Not needed&lt;br /&gt;
&lt;br /&gt;
public static void Main &amp;#40;string&amp;#91;&amp;#93; args&amp;#41;&lt;br /&gt;
&amp;#123;&lt;br /&gt;
if &amp;#40;args.Length &amp;gt; 0&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;string&amp;#91;&amp;#93; lines = File.ReadAllLines&amp;#40;args&amp;#91;1&amp;#93;&amp;#41;;&lt;br /&gt;
&amp;#125; else &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string&amp;#91;&amp;#93; lines = File.ReadAllLines&amp;#40;&amp;quot;wordlist&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;#125; Brace is in the wrong place - it closes the else code block giving the lines error when called in the following foreach code block so need to go after it. &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foreach&amp;#40;string word in lines&amp;#41;&amp;#123; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if &amp;#40;word.Length &amp;lt; 3&amp;#41; continue;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if &amp;#40;word.Contains&amp;#40;&amp;quot;'&amp;quot;&amp;#41;&amp;#41; continue;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;WordList.Add&amp;#40;word.ToLower&amp;#40;&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#125; &lt;br /&gt;
&amp;nbsp; &amp;#125; The brace goes here&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=90355#90355</comments>
                                        <author>Ram</author>
                                        <pubDate>Fri Jun 25, 2010 8:39 am</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=90355#90355</guid>
                                      </item>
                                      <item>
                                        <title>Re: Coding Academy - Unexpected Error Msg.</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=90350#90350</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=65997'&gt;chriswadams&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Fri Jun 25, 2010 12:30 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi Ram--&lt;br /&gt;
&lt;br /&gt;
This line:&lt;br /&gt;
&lt;br /&gt;
[code]static string lines;[/code]&lt;br /&gt;
&lt;br /&gt;
was me declaring the string 'lines' prior to the main body of the program. If I don't put it in there I get this error message:&lt;br /&gt;
&lt;br /&gt;
[code]&amp;quot;The name `lines' does not exist in the current context (CS0103)&amp;quot;[/code]&lt;br /&gt;
&lt;br /&gt;
in reference to the last line of code:&lt;br /&gt;
&lt;br /&gt;
[code]foreach(string word in lines){ [/code]&lt;br /&gt;
&lt;br /&gt;
You asked about this snippet:&lt;br /&gt;
&lt;br /&gt;
[code]{&lt;br /&gt;
if (args.Length &amp;gt; 12){&lt;br /&gt;
string[] lines = File.ReadAllLines(args[1]);&lt;br /&gt;
}[/code]&lt;br /&gt;
&lt;br /&gt;
Well, I assumed that the argument &amp;quot;./wordscramble&amp;quot; would be 12 letters (not counting the ./). I also assumed that &amp;quot;args[1]&amp;quot; would refer to the second [i]element[/i] of the array &amp;quot;args&amp;quot; ie. the file name entered by the user. (Yeah, I know what happens when I assume!)&lt;br /&gt;
&lt;br /&gt;
You also wrote:&lt;br /&gt;
&lt;br /&gt;
[quote]mywordlist would then be stored in (args[0])[/quote]&lt;br /&gt;
&lt;br /&gt;
So, the command &amp;quot;./wordscramble&amp;quot;  isn't considered part of the &amp;quot;args&amp;quot; array? OK, I'll work with that, and see what happens.&lt;br /&gt;
&lt;br /&gt;
Anyway, here is the full &amp;quot;WordScramble&amp;quot; code (note that I have a comment with the error message next to the line that MonoDevelop doesn't like):&lt;br /&gt;
&lt;br /&gt;
[code]&lt;br /&gt;
using System;								//created by Chris Adams 6/16/10&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.IO;&lt;br /&gt;
	&lt;br /&gt;
namespace WordScramble&lt;br /&gt;
{&lt;br /&gt;
	class MainClass&lt;br /&gt;
	{&lt;br /&gt;
		static List&amp;lt;string&amp;gt; WordList = new List&amp;lt;string&amp;gt;();&lt;br /&gt;
		static List&amp;lt;string&amp;gt; UsedList = new List&amp;lt;string&amp;gt;();&lt;br /&gt;
		static Random Rand = new Random();&lt;br /&gt;
		static string PromptLetters;&lt;br /&gt;
		static string lines;&lt;br /&gt;
&lt;br /&gt;
		public static void Main (string[] args)&lt;br /&gt;
		{&lt;br /&gt;
			if (args.Length &amp;gt; 0){&lt;br /&gt;
				string[] lines = File.ReadAllLines(args[1]);&lt;br /&gt;
			}&lt;br /&gt;
			else{&lt;br /&gt;
					string[] lines = File.ReadAllLines(&amp;quot;wordlist&amp;quot;);	&lt;br /&gt;
				}&lt;br /&gt;
				foreach(string word in lines){		       //Error Msg. -&amp;gt; Cannot convert type `char' to `string' (CS0030)&lt;br /&gt;
					if (word.Length &amp;lt; 3) continue;&lt;br /&gt;
					if (word.Contains(&amp;quot;'&amp;quot;)) continue;&lt;br /&gt;
					WordList.Add(word.ToLower());&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			Console.WriteLine(&amp;quot;&amp;quot;);&lt;br /&gt;
			Console.WriteLine(&amp;quot;Welcome to WordScramble!&amp;quot;);&lt;br /&gt;
			Console.WriteLine(&amp;quot;Type !quit to exit, !letters for a reminder, or !next for a new word.&amp;quot;);&lt;br /&gt;
			Console.WriteLine(&amp;quot;&amp;quot;);&lt;br /&gt;
			var score = 0;&lt;br /&gt;
			&lt;br /&gt;
			GetLetters();						//goes to GetLetters subroutine&lt;br /&gt;
			Console.WriteLine(PromptLetters);&lt;br /&gt;
			&lt;br /&gt;
			bool running = true;&lt;br /&gt;
			&lt;br /&gt;
			while (running){&lt;br /&gt;
				string input = Console.ReadLine();				//get player input&lt;br /&gt;
&lt;br /&gt;
				switch (input){				//look for !quit, !next, !letters commands&lt;br /&gt;
				case &amp;quot;!quit&amp;quot;:&lt;br /&gt;
					running = false;&lt;br /&gt;
					break;&lt;br /&gt;
					&lt;br /&gt;
				case &amp;quot;!next&amp;quot;:&lt;br /&gt;
					GetLetters();&lt;br /&gt;
					Console.WriteLine(PromptLetters);			&lt;br /&gt;
					Console.WriteLine(&amp;quot;Score = &amp;quot; + score);&lt;br /&gt;
					break;&lt;br /&gt;
					&lt;br /&gt;
				case &amp;quot;!letters&amp;quot;:&lt;br /&gt;
					Console.WriteLine(PromptLetters);&lt;br /&gt;
					break;&lt;br /&gt;
					&lt;br /&gt;
				default:	//check to be sure word exists, &amp;amp; hasn't been used already&lt;br /&gt;
					if (!UsedList.Contains(input)){&lt;br /&gt;
						if (WordIsPossible(input)){&lt;br /&gt;
							if (WordList.Contains(input)){&lt;br /&gt;
								UsedList.Add(input);&lt;br /&gt;
								var WordScore = WordValue(input);&lt;br /&gt;
								score = score + WordScore;&lt;br /&gt;
								Console.WriteLine(&amp;quot;Good! Score = &amp;quot; + score);&lt;br /&gt;
								&lt;br /&gt;
							} else {&lt;br /&gt;
								Console.WriteLine(&amp;quot;That word doesn't exist!&amp;quot;);&lt;br /&gt;
							}	&lt;br /&gt;
						} else {&lt;br /&gt;
						Console.WriteLine(&amp;quot;Did you forget your letters, or something?&amp;quot;);&lt;br /&gt;
						Console.WriteLine(&amp;quot;Reminder: &amp;quot; + PromptLetters);&lt;br /&gt;
						}&lt;br /&gt;
					} else {&lt;br /&gt;
						Console.WriteLine(&amp;quot;You've used that word already!&amp;quot;);&lt;br /&gt;
						}		&lt;br /&gt;
					break;&lt;br /&gt;
					}	&lt;br /&gt;
				}	&lt;br /&gt;
			}		&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		static void GetLetters(){							//GetLetters subroutine&lt;br /&gt;
			PromptLetters=&amp;quot;&amp;quot;;&lt;br /&gt;
			UsedList.Clear();&lt;br /&gt;
			&lt;br /&gt;
			string word = &amp;quot;&amp;quot;;&lt;br /&gt;
			&lt;br /&gt;
			while (word.Length &amp;lt; &lt;img src=&quot;images/smiles/icon_cool.gif&quot; alt=&quot;Cool&quot; border=&quot;0&quot; /&gt; {&lt;br /&gt;
				word = WordList[ Rand.Next(WordList.Count) ];&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			foreach (char letter in word){&lt;br /&gt;
				PromptLetters = PromptLetters + letter + &amp;quot; &amp;quot;;&lt;br /&gt;
			}	&lt;br /&gt;
		}	&lt;br /&gt;
	&lt;br /&gt;
	static bool WordIsPossible (string word){&lt;br /&gt;
		string letters = PromptLetters;&lt;br /&gt;
&lt;br /&gt;
		foreach (char letter in word){&lt;br /&gt;
			int pos = letters.IndexOf(letter);&lt;br /&gt;
			if (pos != -1){&lt;br /&gt;
				letters = letters.Remove(pos, 1);&lt;br /&gt;
			}else{&lt;br /&gt;
				return false;	&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
			return true;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		static int WordValue(string input) { &lt;br /&gt;
			var wvalue = 0;&lt;br /&gt;
			foreach (char letter in input){&lt;br /&gt;
				wvalue++;&lt;br /&gt;
			}&lt;br /&gt;
			return wvalue;&lt;br /&gt;
		}	&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
[/code]&lt;br /&gt;
&lt;br /&gt;
Thanks for your time, Ram.&lt;br /&gt;
chriswadams</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=90350#90350</comments>
                                        <author>chriswadams</author>
                                        <pubDate>Fri Jun 25, 2010 12:30 am</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=90350#90350</guid>
                                      </item>
                                      <item>
                                        <title>Re: Coding Academy - Unexpected Error Msg.</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=90318#90318</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=130'&gt;Ram&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Thu Jun 24, 2010 1:17 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Think I need to see the rest of your code.. I can't replicate the error using your code.&lt;br /&gt;
&lt;br /&gt;
From your snippet, I don't see the need for this line.&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;static string lines;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt; &lt;br /&gt;
&lt;br /&gt;
However, before you paste your code, can I ask the logic on this snippet of code.&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&amp;#123;&lt;br /&gt;
if &amp;#40;args.Length &amp;gt; 12&amp;#41;&amp;#123;&lt;br /&gt;
string&amp;#91;&amp;#93; lines = File.ReadAllLines&amp;#40;args&amp;#91;1&amp;#93;&amp;#41;;&lt;br /&gt;
&amp;#125;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
As I see it, you would need to launch the program with 14 arguments to read the second argument (args[1]). As in the above snippet.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;text-decoration: underline&quot;&gt;This might help&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Don't forget that counting begins at zero.&lt;br /&gt;
&lt;br /&gt;
So to launch the program without any arguments do this&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;./wordscramble &lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt; &lt;br /&gt;
&lt;br /&gt;
To launch with 1 argument do this&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;./wordscramble mywordlist&amp;nbsp; &amp;nbsp;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
mywordlist would then be stored in (args[0])</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=90318#90318</comments>
                                        <author>Ram</author>
                                        <pubDate>Thu Jun 24, 2010 1:17 am</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=90318#90318</guid>
                                      </item>
                                      <item>
                                        <title>Coding Academy - Unexpected Error Msg.</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=90317#90317</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=65997'&gt;chriswadams&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Jun 23, 2010 10:05 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi, all--&lt;br /&gt;
&lt;br /&gt;
I'm working on Project 2 of the Coding Academy (WordScramble), and I got an unexpected error message while doing Homework #3. The offending code is:&lt;br /&gt;
&lt;br /&gt;
static string lines;&lt;br /&gt;
public static void Main (string[] args)&lt;br /&gt;
     {&lt;br /&gt;
	if (args.Length &amp;gt; 12){&lt;br /&gt;
		string[] lines = File.ReadAllLines(args[1]);&lt;br /&gt;
	}&lt;br /&gt;
else{&lt;br /&gt;
	string[] lines = File.ReadAllLines(&amp;quot;wordlist&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
        foreach(string word in lines){&lt;br /&gt;
&lt;br /&gt;
and the error message for the last line is this:&lt;br /&gt;
&lt;br /&gt;
Cannot convert type `char' to `string' (CS0030)&lt;br /&gt;
&lt;br /&gt;
This problem didn't crop up until I began the 3rd homework assignment (ie. the code worked fine up to that point), so I assume I did something wrong there, but I can't figure out what it was. The variable 'word' is declared to be a string in the code I pasted above, and the variable 'lines' is an array, so why the compiler thinks they are 'char' and 'string' types, I have no idea. Any suggestions?&lt;br /&gt;
&lt;br /&gt;
I can paste in the code for the rest of the program if that will be of any help.&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
chriswadams</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=90317#90317</comments>
                                        <author>chriswadams</author>
                                        <pubDate>Wed Jun 23, 2010 10:05 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=90317#90317</guid>
                                      </item></channel></rss>