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

Luis Santos
Luis Santos
3,566 Points

I am utterly stuck again lol....right when I thought I was out, C# pulls me back in!!!

I am having trouble figuring out the loop sequence in this challenge. What I have so far, is the best that I can make of the problem so far. Please HELP ME!!!

Program.cs
using System;

namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {
            Console.Write("Enter the number of times to print \"Yay!\": ");

          var numOfTimes = System.Console.ReadLIne();

          int num = int.Parse(numOfTimes);

          for (int i=0; i<num; i++) {

          System.Console.WriteLine("\"Yay!\"");
          }
        }

You are missing the closing curly bracket and check the capitalization on System.Console.ReadLine. Also I don't think you're supposed to included the double-quotes in the string, so you can remove the escape sequence.

1 Answer

Steven Parker
Steven Parker
231,236 Points

I see two issues:

  • C# is case-sensitive. The "i" in ReadLine needs to be lower case.
  • each open brace ({) needs a matching closing brace (})

Fix those and you should be good. And you don't need the quotes around "Yay!" as Scott pointed out, but leaving them will not affect passing the challenge.