ZIP
  • 27 May 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

ZIP

  • Dark
    Light
  • PDF

Given two lists, returns a list of lists, where the first list contains the first items of the source lists, the second list contains the second items and so on.

If the lists don't have an equal number of items, the extra items are discarded.

Function signature

ZIP(list1: Array, list2: Array) => Array
Parameter Description
List 1 First list to zip
List 2 Second list to zip

Examples

numbers = [100,3,20,50]
numbers2 = [1,2,3]
strings = ["a","b"]
emptyArray = []
Formula Return value
ZIP(numbers, numbers2) [[100,1],[3,2],[20,3]]
ZIP(numbers, strings) [[100,"a"],[3,"b"]]
ZIP(numbers, emptyArray) []

Was this article helpful?

What's Next