PoshCode Logo PowerShell Code Repository

The Letter Diamond Oneli by Karl Prosser 7 years ago (modification of post by Joel Bennett view diff)
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1032"></script>download | new post

@CAMurphy A slightly more elegant PowerShell version for his challenge
-Refactored Jaykuls down to a 1 liner, but couldn’t get it smaller than a twitter message length

  1. &{Param([char]$l)$s=66;$z=[int]$l;$o=$z-$s+ 5;$p=-1;$n=&{"$(" "*$o)A";([string[]][char[]]($s..$z))|%{$p+=2;$o--;"$(" "*$o)$_$(" "*$p)$_"}};$n;$n[$($n.Length-2)..0]}L

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

Remember me