Всем привет) Нужна помощь) написал кодик по выводу города и страны? если правильно выдает название города и страны и доп.слово. Вылезает предупреждение “Will never be executed”. А так же при выборе правильной страны и города выдает не верный результат.
let cityUSA = “Washington”
let cityRussia = “Moscow”
let cityGermany = “Berlin”
let cityFinland = “Helsinky”
let cityItaly = “Rome”
let countryUSA = “USA”
let countryRussia = “Russia”
let countryGermany = “Germany”
let countryFinland = “Finland”
let countryItaly = “Italy”
func cityOfCountry (city: String, country: String) -> String {
if cityUSA == countryUSA {
return("(cityUSA) - (countryUSA) - Right")
} else if cityUSA != countryUSA{
return("(city) - (country) - No Right")
}
if cityRussia == countryRussia {
return("(cityRussia) - (countryRussia) - Right")
} else {
return("(city) - (country) - No Right")
}
if cityGermany == countryGermany {
return("(cityGermany) - (countryGermany) - Right")
} else {
return("(city) - (country) - No Right")
}
if cityFinland == countryFinland {
return("(cityFinland) - (countryFinland) - Right")
} else {
return("(city) - (country) - No Right")
}
if cityItaly == countryItaly {
return("(cityItaly) - (countryItaly) - Right")
} else {
return("(city) - (country) - No Right")
}
}
Не могу до конца понять логику, как сделать