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 trialMatthew Musni
610 PointsIt won't work. It Doesn't loop. What's wrong
when i run the program it doesnt have errors but it doesnt perform its function. When i type quit it says "youve entered quit minutes". I dont get it.
'''
using System;
namespace teamtreehouse1 { class MainClass { public static void Main(string[] args) {
int runningTotal = 0;
bool keepGoing = true;
while(keepGoing)
{
// Prompt the user for minutes exercised
Console.Write("Enter how many times you exercised or type \"quit\" to exit: ");
string entry = Console.ReadLine();
if(entry == "quit")
{
keepGoing = false;
}
else
{
// Add minutes exercised to total
int minutes = int.Parse(entry);
runningTotal = runningTotal + minutes;
// Display total minutes exercised to the screen
Console.WriteLine("You've entered " + runningTotal + " minutes");
// Repeat until the user quits
}
}
Console.WriteLine("Goodbye");
}
}
}
'''
Jon Wood
9,884 PointsYep, the code looks good to me! :) When experimenting I either fire up Rider (no longer free for long, I believe) or just going to .NET Fiddle. They have better language support in terms of letting you know of compile errors as you're typing and intellisense.
1 Answer
Steven Parker
231,210 PointsYou must have been using different code.
The code above is not capable of the behavior you describe.
Matthew Musni
610 PointsMatthew Musni
610 Pointsok guys i tried to create a new project in Xamarin studio then copied my code there and it worked! i don't why but it now works!