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 Wrap Up

hakan Gülay
hakan Gülay
8,489 Points

practice project - averager

while (keepgoing)
            {

                Console.Write("Enter a number or type \"done\" to calculate average of numbers : ");


                var number = Console.ReadLine();

                if (number.ToLower() == "done")
                {

                    Console.WriteLine("Numbers of average =  " + averageofnumbers);
                    continue;
                }
}

Hi guys, I have a simple question. when I type "done" it calculates average it is ok but it prints "Enter a number or type \"done\" to calculate average of numbers : " again. I know that it prints because of "continue" but how can I remove that ? I dont want it prints again. I hope I could expalin myself.

geoffrey
geoffrey
28,736 Points

Hi hakan Gülay try to use markown to format your code, It makes the code easier to read. For the "problem" you have, I agree with Evan Demaris . Don't forget to mark his answer as best answer, if it answers your question.

1 Answer

Hi Hakan,

It sounds like you want to only see the first log once. The easiest way to do that would be to just move the first log outside your while loop.

Hope that helps, Evan