Skip to content

Commit c97a14a

Browse files
bobbytreedsdwheeler
authored andcommitted
Bobbytreed issue3571 (#3780)
* Fixes #3618, Fixes #3571 - Add enumerator content to automatic variables * Stashing changes * Stashing changes * synchronizing versions * Updating style * Updating date * Update about_Automatic_Variables.md
1 parent fa05f37 commit c97a14a

File tree

20 files changed

+3244
-1274
lines changed

20 files changed

+3244
-1274
lines changed

reference/3.0/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md

Lines changed: 435 additions & 64 deletions
Large diffs are not rendered by default.

reference/3.0/Microsoft.PowerShell.Core/About/about_Foreach.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
---
2-
ms.date: 11/28/2017
1+
---
2+
md.date: 2/27/2019
33
schema: 2.0.0
44
locale: en-us
55
keywords: powershell,cmdlet
66
title: about_Foreach
77
---
88
# About ForEach
99

10-
## SHORT DESCRIPTION
11-
10+
## Short description
1211
Describes a language command you can use to traverse all the items in a
1312
collection of items.
1413

15-
## LONG DESCRIPTION
14+
## Long description
1615

17-
The Foreach statement (also known as a Foreach loop) is a language construct
16+
The `Foreach` statement (also known as a `Foreach` loop) is a language construct
1817
for stepping through (iterating) a series of values in a collection of items.
1918

2019
The simplest and most typical type of collection to traverse is an array.
21-
Within a Foreach loop, it is common to run one or more commands against each
20+
Within a `Foreach` loop, it is common to run one or more commands against each
2221
item in an array.
2322

2423
## Syntax
2524

26-
The following shows the ForEach syntax:
25+
The following shows the `ForEach` syntax:
2726

28-
```syntax
27+
```
2928
foreach ($<item> in $<collection>){<statement list>}
3029
```
3130

@@ -54,7 +53,7 @@ string values `"a"`, `"b"`, `"c"`, and `"d"`. The first time the `Foreach`
5453
statement runs, it sets the `$letter` variable equal to the first item in
5554
`$letterArray` (`"a"`). Then, it uses the `Write-Host` cmdlet to display the
5655
letter a. The next time through the loop, `$letter` is set to `"b"`, and so
57-
on. After the `Foreach` loop displays the letter d, Windows PowerShell exits
56+
on. After the `Foreach` loop displays the letter d, PowerShell exits
5857
the loop.
5958

6059
The entire `Foreach` statement must appear on a single line to run it as a
@@ -158,6 +157,8 @@ variable inside of a foreach script block. The example function can find
158157
functions in a script even if there are unusually- or inconsistently-spaced
159158
function definitions that span multiple lines.
160159

160+
For more information, see [Using Enumerators](about_Automatic_Variables.md#using-enumerators).
161+
161162
```powershell
162163
function Get-FunctionPosition {
163164
[CmdletBinding()]
@@ -226,4 +227,4 @@ function Get-FunctionPosition {
226227

227228
[about_If](about_If.md)
228229

229-
[ForEach-Object](../ForEach-Object.md)
230+
[ForEach-Object](../ForEach-Object.md)

0 commit comments

Comments
 (0)