Monday, August 19, 2013

Automatic whole number sequences in PowerShell

Try this:

 5..15 | ForEach {Write-Host $_}

That's a very interesting way to make some whole number sequences.

It also works in reverse and with negative numbers, i.e. 10..-5 | ForEach {Write-Host $_}