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

C# basic

I have been working on this for too long, i need help. can someone please help me correct this so that it runs. Thank you.

Program.cs
using System;

namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {
            var count = 0;
            while (true)
            {
                Console.Write("Enter the number of times to print \"Yay!\": ");
                var input = Console.ReadLine();
                var inputTimes = int.Parse(input);

                if (inputTimes <= count)
                {
                    Console.Write("That is not enough for a Yay");
                    continue;
                }
                else
                {
                    Console.Write("Yay!")
                    count = count + 1;
                }
            }
         }
    }
}

1 Answer

Steven Parker
Steven Parker
231,096 Points

The loop should start after the input.

The prompt and input will only occur one time, so that part should not be inside the loop.

Also, the challenge is very picky about output messages. Only output what the instructions ask for specifically. Save the creative explorations for the workspace.