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

Xavier Swehla
Xavier Swehla
2,852 Points

Code took too long to run

i keep getting an error saying "Bummer! Your code took too long to run." why is that? I do not understand why I would receive this error when I am not even running this code.

Program.cs
using System;

namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {
            int i = 0;
            Console.Write("Enter the number of times to print \"Yay!\": ");
            string numberOfYays = Console.ReadLine();

            while (i <= int.Parse(numberOfYays));
            {
                Console.Write("Yay");
                i = i ++;
        }
        }
    }
}

1 Answer

Allan Clark
Allan Clark
10,810 Points

looks like you should just need to take the semicolon off this line

while (i <= int.Parse(numberOfYays));