I have a viewController that has a variable and it's getting the value of this variable from another view controller so the variable is like this for example..
var name = "Step-Up to Emergency Medicine"
and there is a button when clicked it's append this string to an arraylist
@IBAction func add(_ sender: Any) {
myArray.append(name)
}
my question is how to prevent the arraylist from adding the same string value twice?