From the following code, I want y to return multiple values, but the program returns only the last one.
public int runDraw()
{
for (int j = 1; j <= numberofDraws; j++)
{
...
if (even_count > odd_count)
{
Console.WriteLine("The result of {0} draw is Even.", j);
y = 1;
}
else if (even_count < odd_count)
{
Console.WriteLine("The result of {0} draw is Odd.", j);
y = 2;
}
else
{
Console.WriteLine("The result of {0} draw is Draw.", j);
y = 3;
}
}
return y;
}
ycan only hold a single value at a time. The fact that you reset it in a loop doesnt change that and it onlyreturns after the entire loop has run