Skip to main content

Description

Combines two lists element-by-element into a list of pairs. Each pair contains one element from the first list and the corresponding element from the second list. The resulting list has the length of the shorter input list.

Syntax

Parameters

Returns

Type: list of lists A list where each element is a two-element array [item1, item2] combining corresponding elements from both lists. Returns an empty list if either input is not an array.

Examples

Example 1: Basic Zipping

Output:

Example 2: Different Length Lists

Output:
(Only pairs up to the length of the shorter list)

Example 3: Creating Key-Value Pairs

Notes

  • Returns empty list if either input is not an array or is null
  • Result length is limited by the shorter of the two input lists
  • Excess elements from the longer list are ignored
  • Useful for pairing related data or creating key-value associations

See Also

Frequently Asked Questions

It returns a list of two-element lists (pairs), combining elements from two input lists by position. For example, flex.coll.zip([1,2], ['a','b']) returns [[1,'a'],[2,'b']].
The result length matches the shorter list. Extra elements from the longer list are ignored.