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,719 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