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 trialChristian Poppe
290 PointsProgram.cs(33,16): error CS0136
This comes up, and does not change even when I change the string 'entry' to something like 'item'.
Christian Poppe
290 Pointsusing System;
namespace Treehouse.FitnessFrog {
class Program { static void Main() { int runningTotal = 0;
bool keepGoing = true;
while (keepGoing)
{
// Prompt the user for minutes exercised
Console.Write("Enter how many minutes you exercised: ");
string entry = Console.ReadLine();
// 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
}
// Prompt the user for minutes exercised
Console.Write("Enter how many minutes you exercised: ");
string entry = Console.ReadLine();
// 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
}
} }
1 Answer
Steven Parker
231,269 PointsIt looks like the code in the loop somehow got duplicated again after the loop. Get rid of the duplicated code and that should fix the issue.
But you'll also need some additional code inside the loop to change the value of "keepGoing" so the program can end when the user wants to quit.
Christian Poppe
290 PointsChristian Poppe
290 PointsProgram.cs(33,16): error CS0136: A local variable named
entry' cannot b e declared in this scope because it would give a different meaning to
e ntry', which is already used in achild' scope to denote something else Program.cs(36,13): error CS0136: A local variable named
minutes' cannot be declared in this scope because it would give a different meaning tominutes', which is already used in a
child' scope to denote something else