locked
Invalid Token Error RRS feed

  • Question

  • I've just started reading 'Head First c#' and I'm stuck.  I can't figure out what's wrong with this code.  Someone please help me. 

    Monday, September 5, 2011 11:20 PM

Answers

  • you have an extra semicolon ; and are missing the enclosing {}

     

    try something like:

     

    class AnotherClass

    {

    public static void main()

    {

        MesageBox.Show("pow!");

    }

    }

    • Proposed as answer by Dylan-Meeus Monday, September 5, 2011 11:51 PM
    • Marked as answer by Dummy yoyo Tuesday, September 13, 2011 1:54 AM
    Monday, September 5, 2011 11:25 PM
  • To add to Hugo's answer:

    You can use the Visual Studio Editor to verify these kind of things.

    If you had written your line correctly, the editor will automaticaly ident the lines inside (like a tab).

    Therefor, when you see such a thing, you can surely know that you did not write it well.

    And the first thing to check is the semicolon.

     

    Noam B.



    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...
    • Marked as answer by Dummy yoyo Tuesday, September 13, 2011 1:54 AM
    Tuesday, September 6, 2011 6:54 AM

All replies

  • you have an extra semicolon ; and are missing the enclosing {}

     

    try something like:

     

    class AnotherClass

    {

    public static void main()

    {

        MesageBox.Show("pow!");

    }

    }

    • Proposed as answer by Dylan-Meeus Monday, September 5, 2011 11:51 PM
    • Marked as answer by Dummy yoyo Tuesday, September 13, 2011 1:54 AM
    Monday, September 5, 2011 11:25 PM
  • Thank you Hugo.
    Tuesday, September 6, 2011 1:48 AM
  • To add to Hugo's answer:

    You can use the Visual Studio Editor to verify these kind of things.

    If you had written your line correctly, the editor will automaticaly ident the lines inside (like a tab).

    Therefor, when you see such a thing, you can surely know that you did not write it well.

    And the first thing to check is the semicolon.

     

    Noam B.



    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...
    • Marked as answer by Dummy yoyo Tuesday, September 13, 2011 1:54 AM
    Tuesday, September 6, 2011 6:54 AM