I have this code:
float s = 0.0;
if (b > 240.0)
{
s = 780.0 + (b - 240.0) * 100.0;
}
else if (b > 90.0)
{
s = 80.0 + (b - 90.0) * 5.0;
}
else
{
s = (b < 10.0) ? (b / 10.0) : (b - 10.0);
}
Is there a way, how to rewrite this without if-else statements? Even for the cost, that something will be computed and not used.
Aucun commentaire:
Enregistrer un commentaire