My question is not about how to solve this error(I already solved it) but why is this error with boolean value.
My function is
private string NumberT
private string NumberToString(int number, bool flag)
{
string str = "";
switch(flag)
{
case true:
str = number.ToString("00");
break;
case false:
str = number.ToString("0000");
break;
}
return str;
}
write this string str = "";
- you should assign value
if you add default case there is no chance to fall through the switch cases without assigning. Now it is