Contact: aviboots(AT)netvision.net.il
39,885 questions
51,811 answers
573 users
import Foundation let byteArray: [UInt8] = [1, 2, 3, 4, 5] print(byteArray) /* run: [1, 2, 3, 4, 5] */
import Foundation let byteArray = [UInt8](repeating: 0, count: 5) // 5 elements, all initialized to 0 print(byteArray) /* run: [0, 0, 0, 0, 0] */
import Foundation let byteArray = [UInt8](repeating: 16, count: 5) // All elements set to 16 print(byteArray) /* run: [16, 16, 16, 16, 16] */
import Foundation let byteArray = [UInt8](repeating: 16, count: 5) // All elements set to 16 print(byteArray.map { String($0) }.joined(separator: ", ")) /* run: 16, 16, 16, 16, 16 */