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 trialPrimoz Koren
1,194 PointsHello, I compleated 2 of 3 tasks, but the third is saying: Oops! It looks like Task 1 is no longer passing.
Task 1: This final code challenge will require you to use almost everything we've covered in this course. You’ll write a program to celebrate completing this course by printing “Yay!” to the screen a given number of times. Write a program that: Prompts the user to enter the number of times to enter “Yay!”. I've done this for you. Leave this as it is. Prints “Yay!” to the screen that number of times (Hint: You’ll need a loop for this. You’ll also need to keep track of how many times the loop has run). You can print them all on the same line or on separate lines.
What am I missing??
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
while(true)
{
Console.Write("Enter the number of times to print \"Yay!\": ");
var enter = Console.ReadLine();
var zero = 0;
if(enter.ToLower() == "quit")
{
break;
}
try
{
var times = int.Parse(enter);
if(times < 0)
{
Console.Write("You must enter a positive number.");
continue;
}
while(zero != times)
{
Console.Write("Yay!");
zero = zero + 1;
continue;
}
}
catch(FormatException)
{
Console.Write("You must enter a whole number.");
continue;
}
}
}
}
}
1 Answer
Jon Mirow
9,864 PointsHi there!
I haven't done any C# yet, but on the courses I have done this usually just means there's an error in the code you just wrote, not the previous code.
When you submit, it runs a whole bunch of tests, typically if you have a syntax error, then your code can't compile, so it can't run the checks on your earlier work, so I'd start there :)