Joined: 29 Jun 2006 Posts: 1641 Location: New York City
Posted: Fri Jan 18, 2008 4:42 pm Post subject: Weird C# Error
For some reason I can't even compile a simple C# Hello program. It tells me I have invalid tokens where pointed out in the quote below.
Code:
using System;
class Hello
{
public static void Main();
{ <-------------This opening bracket
Console.WriteLine("Hello"); <-------The first parenthesis here
}
} <-------- This closing bracket
Could it possibly be because I'm using the 2005 Visual Studio command prompt? >_<
NINTENDO Grandmaster Cheater Supreme Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
Posted: Fri Jan 18, 2008 5:22 pm Post subject: Re: Weird C# Error
The Shadow wrote:
For some reason I can't even compile a simple C# Hello program. It tells me I have invalid tokens where pointed out in the quote below.
Code:
using System;
class Hello
{
public static void Main();
{ <-------------This opening bracket
Console.WriteLine("Hello"); <-------The first parenthesis here
}
} <-------- This closing bracket
Could it possibly be because I'm using the 2005 Visual Studio command prompt? >_<
In C# you dont end main with ; It is as simple as that.
Code:
using System;
class Hello
{
static void Main(string[] args)
{ //<-------------This opening bracket
Console.WriteLine("Hello"); //<-------The first parenthesis here
}
} //<-------- This closing bracket
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
Posted: Fri Jan 18, 2008 8:09 pm Post subject:
For God's sake, man, indent your code!
Code:
using System;
class Hello
{
public static void Main();
{ <-------------This opening bracket
Console.WriteLine("Hello"); <-------The first parenthesis here
}
} <-------- This closing bracket
It might not be much now, but believe me, when it gets into a much larger projects, it's gonna suck to have un-indented code. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum