// Bad words set... Place all nasty words in this set...
let badWords: Set=["shit", "Shit", "SHIT", "Sh1t"]
//
// Function to check for badwords in the badWords Set
//
func checkForBadWord(_in: String) -> Bool {
let temp: Set=[_in]
var check: Bool!
if temp.isDisjoint(with: badWords) == false
{
check = true
} else {
check = false
}
return check
}
//
// Fun function to print your name!
//
func sayHi(to: String) {
print("Hi \(to)!")
}
//
// Main program starts here!
//
let yourName = "coty"
if checkForBadWord(_in: yourName)
{
print("Please don't use bad words!")
}
else
{
sayHi(to: yourName)
}