Skip to content

Commit aae2f19

Browse files
authored
Minor corrections in variables_and_subexpressions.md (#906)
1 parent 7eff21b commit aae2f19

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

book/variables_and_subexpressions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ We can use a variable path to evaluate the variable `$my_value` and get the valu
122122
testuser
123123
```
124124

125-
Sometimes, we don't really know the contents of a variable. Accessing values as shown above can result to errors if the path used does not exist. To more robustly handle this, we can use the question mark operator to return `null` in case the path does not exist, instead of an error, then we would write custom logic to handle the `null`.
125+
Sometimes, we don't really know the contents of a variable. Accessing values as shown above can result in errors if the path used does not exist. To more robustly handle this, we can use the question mark operator to return `null` in case the path does not exist, instead of an error, then we would write custom logic to handle the `null`.
126126

127127
For example, here, if row `0` does not exist on `name`, then `null` is returned. Without the question mark operator, an error would have been raised instead
128128

@@ -144,11 +144,11 @@ You can always evaluate a subexpression and use its result by wrapping the expre
144144

145145
The parentheses contain a pipeline that will run to completion, and the resulting value will then be used. For example, `(ls)` would run the [`ls`](/commands/docs/ls.md) command and give back the resulting table and `(git branch --show-current)` runs the external git command and returns a string with the name of the current branch. You can also use parentheses to run math expressions like `(2 + 3)`.
146146

147-
Subexpressions can also be pipelines and not just single commands. If we wanted to get a list of filenames larger than ten kilobytes, we can use an subexpression to run a pipeline and assign the result to a variable:
147+
Subexpressions can also be pipelines and not just single commands. If we wanted to get a table of files larger than ten kilobytes, we could use a subexpression to run a pipeline and assign its result to a variable:
148148

149149
```
150-
> let names_of_big_files = (ls | where size > 10kb)
151-
> $names_of_big_files
150+
> let big_files = (ls | where size > 10kb)
151+
> $big_files
152152
───┬────────────┬──────┬──────────┬──────────────
153153
# │ name │ type │ size │ modified
154154
───┼────────────┼──────┼──────────┼──────────────
@@ -175,7 +175,7 @@ It depends on the needs of the code and your particular style which form works b
175175

176176
## Short-hand subexpressions (row conditions)
177177

178-
Nushell supports accessing columns in a subexpression using a simple short-hand. You may have already used this functionality before. If, for example, we wanted to only see rows from [`ls`](/commands/docs/ls.md) where the entry is at least ten kilobytes we can write:
178+
Nushell supports accessing columns in a subexpression using a simple short-hand. You may have already used this functionality before. If, for example, we wanted to only see rows from [`ls`](/commands/docs/ls.md) where the entry is at least ten kilobytes we could write:
179179

180180
```
181181
> ls | where size > 10kb
@@ -189,4 +189,4 @@ The `where size > 10kb` is a command with two parts: the command name [`where`](
189189
> ls | where {|$x| $x.size > 10kb }
190190
```
191191

192-
For short-hand syntax to work, the column name must appear on the left-hand side of the operation (like `size` in `size > 10kb`).
192+
For the short-hand syntax to work, the column name must appear on the left-hand side of the operation (like `size` in `size > 10kb`).

0 commit comments

Comments
 (0)