What is the cleanest way of checking multiple strings in an if statement, I want to be able to check to see if the users country is one that uses the euro which I will put in the ("???") .Because this works.
if (usercountry.equals("FRA")||usercountry.equals("FRA")||usercountry.equals("FRA")||usercountry.equals("FRA")||usercountry.equals("FRA")||usercountry.equals("FRA")||usercountry.equals("FRA")||usercountry.equals("FRA")||usercountry.equals("FRA"))
{
costpermile = costpermile*1.42; //(costpermile=£) (costpermile*1.42=Euros)
}
but it looks awful
BTW im not checking France over and over again its still prototype code and so I haven't entered every euro country without checking if there was a better way first. Thanks in advance
Aucun commentaire:
Enregistrer un commentaire