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

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