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 trial

C# C# Basics (Retired) Perfect Final

Benneth Paredis
Benneth Paredis
4,597 Points

Cant get the program working although i think my code is correct

Would somebody be so nice to check my code if it is correct, it is giving errors and i dont know why.

Program.cs
using System;

namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {
            Console.Write("Enter the number of times to print \"Yay!\": ");
            string input = Console.readLine();
            int numberOfTimes = int.parse(input);
            int counter = 0;
            while (counter < numberOfTimes)
             {
              counter++;
                 Console.writeLine("Yay!");
             }
        }
    }
}

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! The problem with your code comes down to capitalization issues. Remember that C# is case-sensitive.

  • int.parse should be int.Parse
  • readLine should be ReadLine
  • writeLine should be WriteLine

Make these changes and give it another go! Good luck! :sparkles:

Benneth Paredis
Benneth Paredis
4,597 Points

Thank you very much i cant believe i missed such a small thing :D