0
Swift4
For example, i have a variable: var a = "feres" and a set: var b:set = ["david","james"] do i can add a variable to the set like this: var a = "feres" var b :set =["david","james"] for a in b { print ("\(a") }
1 Resposta
+ 2
No you're just going to print the elements of b. Try this:
var a = "feres"
var b = ["david","james"]
b.append(a)
print(b)
//david, james,feres
Or with a set:
var c:Set = ["a","b"]
c.update(with: a)
print(c)
//a, b,feres