Expected unqualified-id before 'public' | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Expected unqualified-id before 'public'

using System; public class MainClass { public static void Main() { string yourName; Console.WriteLine("What is your name? "); yourName = Console.ReadLine() ; Console.WriteLine("Hello{0},yourName") ; } } It keeps showing me expected unqualified-id before 'public'

25th Sep 2016, 10:28 AM
Paul Osakue
Paul Osakue - avatar
2 Answers
+ 1
You need to include a namespace too, also your Main() function should include the start parameters (shown below). Here is the starting template: using System; namespace Sololearn { class Program { static void Main(string[] args) { } } }
25th Sep 2016, 11:26 AM
sfgjk
+ 1
Thanks
25th Sep 2016, 9:32 PM
Paul Osakue
Paul Osakue - avatar