Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Basics (Retired) Perfect Final

Edward Hwang
PLUS
Edward Hwang
Courses Plus Student 1,047 Points

for loop isn't working

My for loop's not working and I don't know why! Please help. Here's my code: using System;

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

        for(int i = 0; i<= number; i++);
        {
            Console.WriteLine("Yay!");

        }
    }
}

}

1 Answer

stjarnan
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
stjarnan
Front End Web Development Techdegree Graduate 56,488 Points

Hi Edward,

I see one error in your code, which is a misplaced semicolon.

for(int i = 0; i<= number; i++); <--- This semicolon breaks your code

When that is fixed your code will work, but it will not be be able to get you past this challenge just yet. The error you receive will be very helpful and let's see if you can figure it out on your own, if not I will guide you :)

I hope this helps

Jonas