my problem in text :
I have three arrays one have cars company name ["Toyota","Audi","Nissan"] , the other one have car module number ["2008","2009","2010","2011","2012"], and the last one have cars name ["Camry","Landcruser"].
I want a short clean method to do the following :
if input (1) was ["Nissan"] and input (2) was ["camry"] and input (3) was "2008" until "2011" { result.text = "some text" }
I did all thing right but my problem is in this code[ "2008" until "2011" ] how can I do this with if ?
here is my code :
if (carCompass.text == "Nissan") && (carTpass.text == "camry") && (carMpass.text == "2008") || (carMpass.text == "2009") ||
(carMpass.text == "2010") || (carMpass.text == "2011") ||
(carMpass.text == "2012") && (calc_color.backgroundColor == UIColor(red: 0.2078, green: 0.4471, blue: 0.349, alpha: 1.0)) {
result.text = " \(landcruzer08_18)" + "L" + "\(landcruzer08_18*1.37) SAR"
}
its work fine , but I think its not clean or professional
Aucun commentaire:
Enregistrer un commentaire