function Write-BottlesOfBeer {
param(
[int]$bottles = 99
)
$b='bottles of beer'
$w='on the wall'
$n='no more'
$bottles..1 | %{
"$_ $b $w, $_ $b.`r".Replace('bottles',"bottle$(if($_ -gt 1){'s'})")
"Take one down and pass it around, $(if(($_-1) -ge 1){$_-1} else {$n}) $b $w.`r".Replace('bottles',"bottle$