Skip to content

Commit 19bdec3

Browse files
Apply suggestions from code review
Co-authored-by: Sean Wheeler <[email protected]>
1 parent 1a84446 commit 19bdec3

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

reference/docs-conceptual/learn/ps101/06-flow-control.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ When you move from writing PowerShell one-liners to writing scripts, it sounds m
1414
it is. A script is nothing more than the same or similar commands you run interactively in the
1515
PowerShell console, except you save them as a `.PS1` file. There are some scripting constructs that
1616
you might use, such as a `foreach` loop instead of the `ForEach-Object` cmdlet. The differences can
17-
be confusing for beginners when considering that `foreach` is both a scripting construct and an
17+
be confusing for beginners when considering that `foreach` is both a language keyword and an
1818
alias for the `ForEach-Object` cmdlet.
1919

2020
## Looping
@@ -29,9 +29,9 @@ through the items using one of the different types of loops in PowerShell.
2929
one-liners. `ForEach-Object` streams the objects through the pipeline.
3030

3131
Although the **Module** parameter of `Get-Command` accepts multiple string values, it only accepts
32-
them via pipeline input by property name or parameter input. In the following scenario, if you want
33-
to pipe two strings by value to `Get-Command` for use with the **Module** parameter, you would need
34-
to use the `ForEach-Object` cmdlet.
32+
them via pipeline input by property name. In the following scenario, if you want to pipe two string
33+
values to `Get-Command` for use with the **Module** parameter, you need to use the `ForEach-Object`
34+
cmdlet.
3535

3636
```powershell
3737
'ActiveDirectory', 'SQLServer' |
@@ -133,8 +133,8 @@ UserPrincipalName :
133133
```
134134

135135
As you can see in the previous examples, the **Identity** parameter for `Get-ADComputer` only
136-
accepts a single value when provided via parameter input. It allows for multiple items when you
137-
provide the input via pipeline input.
136+
accepts a single value when provided via parameter input. However, by using the pipeline, you can
137+
send multiple values to the command because the values are processed one at a time.
138138

139139
### For
140140

@@ -218,8 +218,8 @@ The same results are achieved with a `Do While` loop by reversing the test condi
218218

219219
### While
220220

221-
Like the `Do While` loop, a `While` loop runs as long as the specified condition is true. The
222-
difference, however, is that a `While` loop evaluates the condition at the top of the loop before
221+
Like the `do while` loop, a `while` loop runs as long as the specified condition is true. The
222+
difference, however, is that a `while` loop evaluates the condition at the top of the loop before
223223
any code is run. So, it doesn't run if the condition is evaluated as false.
224224

225225
The following example calculates what day Thanksgiving Day is on in the United States. It's always
@@ -241,7 +241,7 @@ Thursday, November 23, 2017 12:00:00 AM
241241

242242
## Break, Continue, and Return
243243

244-
The `break` statement is designed to exit a loop and is often used with the `switch` statement. In
244+
The `break` keyword is designed to exit a loop and is often used with the `switch` statement. In
245245
the following example, `break` causes the loop to end after the first iteration.
246246

247247
```powershell
@@ -256,7 +256,7 @@ for ($i = 1; $i -lt 5; $i++) {
256256
Sleeping for 1 seconds
257257
```
258258

259-
`Continue` is designed to skip to the next iteration of a loop.
259+
The `continue` keyword is designed to skip to the next iteration of a loop.
260260

261261
The following example outputs the numbers 1, 2, 4, and 5. It skips number 3 and continues with the
262262
next iteration of the loop. Like `break`, `continue` breaks out of the loop except only for the
@@ -282,14 +282,14 @@ while ($i -lt 5) {
282282

283283
`Return` is designed to exit out of the existing scope.
284284

285-
Notice that in the following example, return outputs the first result and then exits out of the
285+
Notice in the following example that `return` outputs the first result and then exits out of the
286286
loop.
287287

288288
```powershell
289289
$number = 1..10
290290
foreach ($n in $number) {
291291
if ($n -ge 4) {
292-
Return $n
292+
return $n
293293
}
294294
}
295295
```

0 commit comments

Comments
 (0)