summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com>2023-08-30 13:31:37 +0200
committerGitHub <noreply@github.com>2023-08-30 13:31:37 +0200
commit8a0dd88f1073f8fac9b2db022027eae3752dffd7 (patch)
tree12b8f5c8bc4ed7daef93e5e152ddac39b0765add /docs
parente1558268f9b813ca6b789909075603eb8dc22af9 (diff)
Make zip variadic (#2041)
Diffstat (limited to 'docs')
-rw-r--r--docs/reference/types.md16
1 files changed, 10 insertions, 6 deletions
diff --git a/docs/reference/types.md b/docs/reference/types.md
index 09cc2909..1136bd27 100644
--- a/docs/reference/types.md
+++ b/docs/reference/types.md
@@ -1033,13 +1033,17 @@ for loop.
- returns: array
### zip()
-Zips the array with another array. If the two arrays are of unequal length, it
-will only zip up until the last element of the smaller array and the remaining
-elements will be ignored. The return value is an array where each element is yet
-another array of size 2.
+Zips the array with other arrays. If the arrays are of unequal length, it will
+only zip up until the last element of the shortest array and the remaining
+elements will be ignored. The return value is an array where each element is
+yet another array, the size of each of those is the number of zipped arrays.
-- other: array (positional, required)
- The other array which should be zipped with the current one.
+This method is variadic, meaning that you can zip multiple arrays together at
+once: `(1, 2, 3).zip((3, 4, 5), (6, 7, 8))` returning:
+`((1, 3, 6), (2, 4, 7), (3, 5, 8))`.
+
+- others: array (variadic)
+ The other arrays which should be zipped with the current one.
- returns: array
### fold()