Access variable inside while loop from outside (C#)?
c#, while-loop
Solution
Declare MAX before you start the while loop. The way you have it you can only access within the while.
Double MAX = 0;
while (Condition)
{
MAX = somecode.....
.....
}
Console.WriteLine("The OPTIMAL Value : " + MAX);
Problem
I'm New to C# and I'm trying to reach the value of MAX from the while so i can use it outside but i can't...anyone have some ideas !!! Thanks In Advance ``` while (Condition) { Double MAX = somecode..... ..... } Console.WriteLine("The OPTIMAL Value : " + MAX); ```