Skip to content

Commit 990bf4a

Browse files
authored
Fix erroneous Nu code in variables.md
Usage: > generate <closure> (initial) The following code example does `generate (initial) <closure>` instead, which is incorrect.
1 parent 76175ae commit 990bf4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

book/variables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ three
132132
While `reduce` processes lists, the [`generate`](/commands/docs/generate.md) command can be used with arbitrary sources such as external REST APIs, also without requiring mutable variables. Here's an example that retrieves local weather data every hour and generates a continuous list from that data. The `each` command can be used to consume each new list item as it becomes available.
133133

134134
```nu
135-
generate khot {|weather_station|
135+
generate {|weather_station|
136136
let res = try {
137137
http get -ef $'https://api.weather.gov/stations/($weather_station)/observations/latest'
138138
} catch {
@@ -148,7 +148,7 @@ generate khot {|weather_station|
148148
next: $weather_station
149149
}
150150
}
151-
}
151+
} khot
152152
| each {|weather_report|
153153
{
154154
time: ($weather_report.properties.timestamp | into datetime)

0 commit comments

Comments
 (0)