You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lang-guide/chapters/types/basic_types/closure.md
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,15 @@ Closures are used in Nu extensively as parameters to iteration style commands li
85
85
1. You can also use [pipeline input as `$in`](pipelines.html#pipeline-input-and-the-special-in-variable) in most closures instead of providing an explicit parameter. For example:
86
86
87
87
```nu
88
-
1..10 | each { print $in }
88
+
1..5 | each { print $in }
89
+
# => 1
90
+
# => 2
91
+
# => 3
92
+
# => 4
93
+
# => 5
94
+
# => ╭────────────╮
95
+
# => │ empty list │
96
+
# => ╰────────────╯
89
97
```
90
98
91
99
1. You can also pass closures themselves into a pipeline assuming the next command knows how to consume it. For example, the `do` example can be rewritten as:
0 commit comments