Coding Academy n00b

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Coding Academy n00b

Postby uber.munkee » Mon Apr 05, 2010 3:15 pm

Hi all,

I've tried a few times to really get stuck in to the Coding Academy projects but I can't get past the first one. I follow the tutorial to the letter but having never coded before I'm not sure what I'm doing wrong.

This is my code:


using System;
using System.IO;

namespace ToDoList
{
class MainClass
{
public static void Main (string[] args)
{
var contents = File.ReadAllText("todo.txt");
foreach (var arg in args) {
Console.WriteLine(arg);
}
}
}


This is as far as I get. If I try this on my own distro, when I press F8 it comes up with an error

Expected '}' (CS1513)

When I try it running the LiveCD and I press F8 I get

Parsing error(CS8025)

Would be grateful for any advice.
uber.munkee
 
Posts: 3
Joined: Sun Jul 26, 2009 2:27 am
Location: The Sprawl

Postby towy71 » Mon Apr 05, 2010 3:51 pm

count the number of opening brackets and closing brackets, they always have to be in pairs ;-) :roll:
still looking for that door into summer
User avatar
towy71
Moderator
 
Posts: 4276
Joined: Wed Apr 06, 2005 2:11 pm
Location: wild West Wales

Postby Ram » Mon Apr 05, 2010 8:20 pm

As towy say's { come in pairs

Try this code.

Code: Select all
using System;
using System.IO;

namespace ToDoList
{
class MainClass
   {
    public static void Main (string[] args)
       {
       var contents = File.ReadAllText("todo.txt");
            foreach (var arg in args) {
                Console.WriteLine(arg);
                }
        }
    }
}





Normally, if you have a syntax error in your code when using MonoDevelop you'll have a red wriggly line under it.

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1684
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough


Return to Programming

Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests