I need to create an array with a limited size, 11 digits of type Integer . I tried it this way, but here an array of zeros is created, and I need an empty array with a limited size consisting of 11 digits of type Integer .

 var temp = [Int](repeating: 0, count: 11) 
  • Do you need exactly [Int] ? Can't use [Int?] ? - Artem Novichkov
  • so what's wrong with what you have in question? hammer in with zeros and then change to the numbers you need - Max Mikheyenko

1 answer 1

Through an array of optional Int :

 var temp = [Int?](repeating: nil, count: 11)