I have created one function to return int value for device type as follows ;
public int getDeviceType(string device)
{
int temp;
if (device.ToLower() == "android")
{
temp = 1;
}
else if (device.ToLower() == "ios")
{
temp = 2;
}
return temp;
}
And i wanted to return the type for device.
But it gives me an error that
"Use of unassigned variable temp"
How can i solve it ?
Thanks.
Just initialize temp with default value like below