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.

Charles Hessifer
Courses Plus Student 11,650 PointsC# Basics - Challenge Task 2 of 3 - What am I missing?
For some reason my code is not passing; however I can compile run on my local dev box. Could someone have a look and see what I might be missing please? (Code Attached)
Thanks in advance!
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
var counter = 0;
while (true)
{
Console.Write("Enter the number of times to print \"Yay!\": ");
try
{
var printCount = int.Parse(Console.ReadLine());
while (counter < printCount)
{
Console.WriteLine("Yay!");
counter += 1;
}
break;
}
catch (FormatException)
{
Console.WriteLine("You must enter a whole number.");
continue;
}
catch (ArgumentNullException)
{
continue;
}
}
}
}
}
1 Answer

Charles Hessifer
Courses Plus Student 11,650 PointsThanks Steven!
Your program must ask for and accept input ONE TIME ONLY, s/continue/return/g
CaH
Charles Hessifer
Courses Plus Student 11,650 PointsCharles Hessifer
Courses Plus Student 11,650 Pointstried with for loop as well: