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#

Cannot get the Frog App to Loop

Does anyone know why my code doesn't loop:

using System;

namespace Treehouse.FitnessFrog { class Program { static void Main() { int runningTotal = 0;

        bool keepGoing = true;
        while(keepGoing)
        {

            Console.Write("Enter how many minutes you exercised or type \"quit\" to exit: ");
            string entry = Console.ReadLine();        

            if(entry == "quit")
            {
                keepGoing = false;
            }
            else
            {

                int minutes = int.Parse(entry);
                runningTotal = runningTotal + minutes;


                Console.WriteLine("You've entered " + runningTotal + " minutes.");
            }

        }

        Console.WriteLine("Goodbye");
    }
}

}

Steven Parker
Steven Parker
231,110 Points

What input do you give, and what output do you see? Do you get an error?

It would help if you can provide a snapshot of your workspace and a link to the course page you are working with.

It just let me input the details once then nothing

treehouse:~/workspace$ mono Program.exe
Enter how many minutes you exercised: 25
You've entered 25 minutes.

Steven Parker
Steven Parker
231,110 Points

The snapshot will make it possible to try it out and analyze the problem. Click on the blue word in the other comment for a video on how to make and share it.

1 Answer

Fredrik Rönnehag
Fredrik Rönnehag
2,342 Points

I copied the code you posted and ran it in VS, for me it's looping.

Steven Parker
Steven Parker
231,110 Points

Same here. I'm counting on the snapshot to reveal some other issue.