I'm just wondering, I found on some sites if-statement written this way
if (x == "a") { y = 1; }
else if (x == "b") { y = 2; }
else if (x == "c") { y = 3; }
else if (x == "d") { y = 4; }
else if (x == "e") { y = 5; }
else if (x == "f") { y = 6; }
else if (x == "g") { y = 7; }
else { y = 8; }
is there any difference for code if usually should be:
if (x == "a")
{
y = 1;
}
else if (x == "b")
{
y = 2;
}
else (x == "c")
{
y = 3;
}
Aucun commentaire:
Enregistrer un commentaire