| 16 | | static if (n>1) |
|---|
| 17 | | const char [] showHowMany = itoa!(n) ~ " " ~ objectname ~ "s"; |
|---|
| 18 | | else static if (n==1) // don't add an "s". |
|---|
| 19 | | const char [] showHowMany = "1 " ~ objectname; |
|---|
| 20 | | else static if (needcapital) |
|---|
| 21 | | const char [] showHowMany = "No more " ~ objectname ~ "s"; |
|---|
| | 22 | static if ( n > 1 ) |
|---|
| | 23 | const char [] showHowMany = itoa!(n) ~ " bottles of beer" ~ where ~ \n; |
|---|
| | 24 | else static if ( n == 1 ) |
|---|
| | 25 | const char [] showHowMany = "1 bottle of beer" ~ where ~ \n; |
|---|
| | 26 | else static if ( needcapital ) |
|---|
| | 27 | const char [] showHowMany = "No more bottles of beer" ~ where ~ \n; |
|---|
| 28 | | pragma(msg, showHowMany!(n, "bottle", CAPITAL) ~ " of beer on the wall,"); |
|---|
| 29 | | pragma(msg, showHowMany!(n, "bottle") ~ " of beer."); |
|---|
| 30 | | |
|---|
| 31 | | const char [] beersleft = showHowMany!( (maxbeers + n ) % (maxbeers+1), "bottle", CAPITAL) |
|---|
| 32 | | ~ " of beer on the wall." \n; |
|---|
| 33 | | |
|---|
| 34 | | static if (n>0) { |
|---|
| 35 | | pragma(msg, "Take one down and pass it around, " \n ~ beersleft); |
|---|
| 36 | | const bool drunk = beer!(maxbeers, n-1).drunk; |
|---|
| 37 | | } else { |
|---|
| 38 | | pragma(msg, "Go to the store and buy some more, " \n ~ beersleft); |
|---|
| 39 | | const bool drunk = true; |
|---|
| 40 | | } |
|---|
| | 34 | static if ( n > 0 ) |
|---|
| | 35 | const char [] beer = showHowMany!(n, " on the wall,", true) |
|---|
| | 36 | ~ showHowMany!(n, ".") |
|---|
| | 37 | ~ "Take one down and pass it around, " \n |
|---|
| | 38 | ~ showHowMany!( n - 1 , " on the wall.") |
|---|
| | 39 | ~ \n ~ beer!(maxbeers, n - 1); // recurse for subsequent verses. |
|---|
| | 40 | else |
|---|
| | 41 | const char [] beer = showHowMany!(n, " on the wall,", true) |
|---|
| | 42 | ~ showHowMany!(n, ".") |
|---|
| | 43 | ~ "Go to the store and buy some more, " \n |
|---|
| | 44 | ~ showHowMany!( maxbeers, " on the wall."); |
|---|