Loops/Foreach: Difference between revisions
Content deleted Content added
m added whitespace before the TOC (table of contents). |
|||
Line 1,518: | Line 1,518: | ||
=={{header|PowerShell}}== |
=={{header|PowerShell}}== |
||
<lang PowerShell> |
|||
<lang powershell>foreach ($x in $collection) { |
|||
$colors = "Black","Blue","Cyan","Gray","Green","Magenta","Red","White","Yellow", |
|||
Write-Host $x |
|||
"DarkBlue","DarkCyan","DarkGray","DarkGreen","DarkMagenta","DarkRed","DarkYellow" |
|||
⚫ | |||
foreach ($color in $colors) |
|||
{ |
|||
Write-Host "$color" -ForegroundColor $color |
|||
} |
|||
⚫ | |||
{{Out}} |
|||
<pre> |
|||
Black |
|||
Blue |
|||
Cyan |
|||
Gray |
|||
Green |
|||
Magenta |
|||
Red |
|||
White |
|||
Yellow |
|||
DarkBlue |
|||
DarkCyan |
|||
DarkGray |
|||
DarkGreen |
|||
DarkMagenta |
|||
DarkRed |
|||
DarkYellow |
|||
</pre> |
|||
=={{header|Prolog}}== |
=={{header|Prolog}}== |