Skip to content

Instantly share code, notes, and snippets.

@jehugaleahsa
Created May 18, 2017 13:28
Show Gist options
  • Save jehugaleahsa/bc1ae81bf9c0360e2710a5d096589127 to your computer and use it in GitHub Desktop.
Save jehugaleahsa/bc1ae81bf9c0360e2710a5d096589127 to your computer and use it in GitHub Desktop.
Tree Script
# let rows: 10
# let lines = from row in 0..rows
# let spaceCount = rows - row
# let spaces = " " * spaceCount
# let stars = "*" * (2 * row + 1)
# let line = spaces + stars + spaces
# select line
# lines.join("\r\n")
$rows = 10
$lines = @(
foreach ($row in 0..$rows)
{
$spaceCount = $rows - $row
$spaces = " " * $spaceCount
$stars = "*" * (2 * $row + 1)
$line = $spaces + $stars + $spaces
$line
}
)
[System.String]::Join([System.Environment]::NewLine, $lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment