I am trying to figure out whether a variable is part of an array.
This is the code:
let Name = "Tim"
var i = ""
let Friends = ["Jim", "Tim", "Anna", "Emma"]
if Name in Friends {
i = "Is a Friend"
} else {
i = "Not a Friend"
}
This does not work in Swift, what is the correct operator?