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") }

1st Nov 2018, 8:10 PM
Feres
Feres - avatar
1 Respuesta
+ 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
1st Nov 2018, 10:04 PM
Uni
Uni - avatar