Post

Replies

Boosts

Views

Activity

Swift functions
var xo = [String]() var xo1 = ["x" , "10" ,"10" ,"10","10"  ] var xo2 = ["10 " , "x" ,"10" ,"10" ,"10" ] var xo3 = ["10 " , "10" ,"x" ,"10" ,"10" ] var xo4 = ["10 " , "10" ,"10" ,"x" ,"10"] var xo5 = ["10 " , "10" ,"10" ,"10" ,"x" ] xo.append(contentsOf: xo1) xo.append(contentsOf: xo2) xo.append(contentsOf: xo3) xo.append(contentsOf: xo4) xo.append(contentsOf: xo5) //for _ in xo { //    print(xo) //} func xos (item: Int , count:Int )  - [String]  {     let xo8 = Array(repeating: item, count: count)     let xo9 = Array(repeating: item, count: count)    } xos(item: xo, count: 1) whats wrong ? how i can print like this : [X, 0, 0, 0, 0] [0, X, 0, 0, 0] [0, 0, X, 0, 0] [0, 0, 0, X, 0] [0, 0, 0, 0, X]
13
0
1.2k
Apr ’21
Functions
let candy: Array = [4 ]  let fruits: Array = [6] func mySweets (itemOne: Int , itemTwo: Int) - String {         let allSweets = candy + fruits          for _ in allSweets {         print(allSweets)     } return (" this \(allSweets) " ) } mySweets(itemOne:candy , itemTwo: fruits) - *Type of expression is ambiguous without more context Why i'm receiving this?
1
0
657
Apr ’21