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# C# Basics (Retired) Perfect if / else if / else

Help pls (console) Any suggestions?

Hey, before I write anything for an input it writes :7:1R. The input keeps changing everytime.

Any suggestions?

3 Answers

I dont think its about the code because sometimes it happens and sometimes does not

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 q: \n");

          string entry = Console.ReadLine();

          if(entry == "q"){
            keepGoing = false;
          }
          else{
            int minutes = int.Parse(entry);
            runningTotal += minutes;
            Console.WriteLine("Youve exercised" + minutes + "minutes");
          }
        }

      }
  }
}
James Churchill
James Churchill
Treehouse Teacher

Erdem,

Just to clarify, if you compile and execute this code in Workspaces using mcs Program.cs && mono Program.exe, you'd see the output ":7:1R" written to the console before being prompted for your input?

Thanks ~James

James Churchill
STAFF
James Churchill
Treehouse Teacher

Erdem,

Are you using Workspaces or Visual Studio? Also, are you still experiencing an issue with this code?

Thanks ~James

I was using workspaces and the problem continued for a while. Then I stopped using workspaces and now using sublime/terminal. I guess there is a problem with workspaces.

Thanks for your concern,

Erdem

James Churchill
STAFF
James Churchill
Treehouse Teacher

Erdem,

Could you post your code?

Thanks ~James