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

I've checked the code in Visual Studio and the prog runs well. But in treehouse doesn't work. do I miss something?

I've checked the code in Visual Studio and the prog runs well. But in treehouse doesn't work. do I miss something?

Program.cs
using System;

namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {
            int loops = 1;
            int times = 0;
            Console.Write($"Enter the number of times to print \"Yay!\": ");
            times = int.Parse(Console.ReadLine());
                while (loops <= times)
                {
                    Console.WriteLine($"Yay!")"
                    ++loops;
                }
            Console.RearLine();
        }
    }
}

1 Answer

Steven Parker
Steven Parker
231,269 Points

This caused no errors in VS?

I would have expected you to have issues with:

  • the mismatched quotes on the line that writes "Yay!"
  • spelling "RearLine" instead of "ReadLine"

Also, you don't need to prefix the strings with "$" since no interpolation is being performed.

:warning: Be careful about testing a challenge in Visual Studio. Beyond just making sure things compile, challenges test for meeting specific objectives. In this case, even if spelled correctly, calling ReadLine after the output would prevent the program from ending and cause the challenge to fail.