Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKevin Khlom
14,369 PointsKeep getting "unexpected symbol" with counter int in C# final.
I keep getting an error with the counter variable. The system errors out counter as an unexpected symbol. Can anybody tell me how I can get around this?
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
Console.Write("Enter the number of times to print \"Yay!\": ");
int entry = Console.ReadLine();
int yay = int.Parse(entry);
var counter = 0;
while (yay > counter)
{
Console.WriteLine("Yay!")
counter += 1;
}
}
}
}
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! When you fix this part you'll find that you have some more errors. But the problem causing your current compilation error is a missing semicolon on this line:
Console.WriteLine("Yay!")
That should be:
Console.WriteLine("Yay!");
Hope this helps!
Kevin Khlom
14,369 PointsKevin Khlom
14,369 PointsThat did help. Thank you so much for your response.