- or download this
"Dear $name" # Perl and PHP
"Dear %s" % expr # Python and Ruby % printf-like operator
...
"Dear "+`expr` # Python backticks (TMTOWTDI)
"Dear #{expr}" # Ruby string interpolation
"Dear @{[expr]}" # Perl "Baby Cart" string interpolation
- or download this
5 * "X" also produces "XXXXX" in Python! TMTOWTDI! :)
5 * "X" ... but not in Ruby (won't compile: type error)
5 x "X" ... or Perl (produces empty string)
- or download this
$"x(318%$_/9) Perl
" "*(318%i/9) Ruby
318%i/9*" " Python
- or download this
n=99
z=lambda:`n or 99`+" bottle"+"s of beer on the wall"[n==1:]
while n:y=z();n-=1;print"%s, %s.\n"*2%(y,y[:-12],n and"Take one down a
+nd pass it around"or"Go to the store and buy some more",z())
- or download this
n and"Take one down and pass it around"or"Go to the store and buy some
+ more"
- or download this
"Take"if n else"Go to"
(n>0)*"Take"or"Go to"
...
("Go to","Take")[n>0]
n and"Take"or"Go to"
"GToa kteo"[n>0::2] # "Slice and Dice" wins this golf!