Swift: Merging of 2 integer arrays
By somaria
2022-11-26
import Cocoa /* Create an array of 2 negative integers */ var negativeIntegers = [-1, -2] /* print the array */ print(negativeIntegers) /* Create an array of 2 positive integers */ var positiveIntegers = [1, 2] /* print the array */ print(positiveIntegers) /* Merge the two arrays */ var allIntegers = negativeIntegers + positiveIntegers /* print the array */ print(allIntegers)

Output

[-1, -2]

[1, 2]

[-1, -2, 1, 2]