A rhyming program you write
Attempting to win the fight
For winning the contest and vote
It must compute "Hello World"
Then print it very polite

The most popular poem will win.

The requirements are:

  • The poem should be of 5 lines with rhymes AABBA
  • It can print whatever you want, but the output should contain "hello world" (uppercase/lowercase does not matter, quotes not included in the output)
  • Symbols are read aloud. For example, the fourth line above is read: It must compute quote hello world quote
  • Post below your code, on another code preview, the "read-aloud" version of your code for disambiguation on special symbols.

Excluded are poems:

  • including dead code, or characters which could be safely removed without changing the rhymes or the functionality
  • Using comments as a way to rhyme (except if there is a good reason for that)
  • using the same symbol as end of phrase for rhyme.

In case of a tie, programs outputting a poem will win. If there is still a tie, shorter programs will win.

New lines do not count. spaces, tabs and newlines are not read aloud. For example, "Hello, world!" would be read aloud "double-quote hello comma world exclamation point double-quote".

  • \$\begingroup\$ The whole program needs to be of five lines? Can't an answer simply be the snippet of required commands? Excluding the class/function declarations and all? \$\endgroup\$ Mar 5, 2014 at 11:10
  • \$\begingroup\$ Yes, the whole program needs to be of five lines. Try to spread your definitions and includes along lines. Most PL have a way to include multiple sentences on a single line with the semi-colon or similar. \$\endgroup\$ Mar 5, 2014 at 12:21
  • \$\begingroup\$ I see that many of the answers are attempting to produce limericks, because you mention that word in your title, but not in your requirements. \$\endgroup\$
    – TRiG
    Jul 2, 2014 at 11:22
  • \$\begingroup\$ That's true. I only want the program to be a limerick. \$\endgroup\$ Jul 2, 2014 at 12:39
  • \$\begingroup\$ I'm voting to close this as too broad because there is no way to objectively determine if an answer is valid. \$\endgroup\$
    – Wheat Wizard
    Nov 11, 2017 at 20:01

20 Answers 20



A rhyming program I	wrote  	   
this poem of whitespace and bloat		 		  
because newlines don't count  		 				
despite the amount   	 	 			
so deserves your sincerest upvote 			  	 

Wikipedia: Whitespace (programming language)
Online Interpreter to Test Answer


Hello World
  • 3
    \$\begingroup\$ This somehow reminds me of the Beatles' Come Together. \$\endgroup\$
    – user12205
    Mar 4, 2014 at 20:54
  • 7
    \$\begingroup\$ It's certainly "over me" \$\endgroup\$ Mar 4, 2014 at 23:52
  • 7
    \$\begingroup\$ Excluded: Using comments as a way to rhyme \$\endgroup\$ Mar 5, 2014 at 17:23
  • 2
    \$\begingroup\$ Well, I forgot that other chars were comments in whitespace. I don't think I will keep this rule because else this would ruin this winner. \$\endgroup\$ Mar 5, 2014 at 18:15
  • 3
    \$\begingroup\$ @MikaëlMayer I think you should keep the rule. I suspect a lot of these votes are mostly from people who are just discovering the charm of Whitespace. Personally, I'm more interested in seeing answers in the spirit of the actual challenge of rhyming code. \$\endgroup\$
    – Jason C
    Mar 6, 2014 at 9:35


    > Hello World! I'm a goat
</span></body></html><!-- Pecan -->

I had to get a little liberal with pronunciation of the last line. I hope it doesn't break the rules. It's also not 100% valid per W3C, but works in most browsers.

less than aich tee em el greater than,
less than body not equal to span,
class equals quote poem end quote,
greater than Hello World Bang I'm a goat
close span close body close root comment pecan
  • 5
    \$\begingroup\$ +1 for clever re-pronunciations... + "Bang, I'm a goat" comment... \$\endgroup\$ Mar 4, 2014 at 22:32
  • 5
    \$\begingroup\$ +1 for reading >< as "not equal" \$\endgroup\$ Mar 5, 2014 at 18:42
  • 3
    \$\begingroup\$ A newbie a poem he wrote-a/ Hoping to get just one vote-a/ And now in this race/ He's in second place!/ With as much rep as several years on StackOverflow-ta. \$\endgroup\$
    – cobaltduck
    Mar 6, 2014 at 14:44


I know this isn't within the rules, but I couldn't resist

var girl, attractive = true;    // There once was a beautiful girl
var boy; girl = ' World';       // And a boy who thought she was his world
boy = 'Hello' + girl;           // When the boy said hello
if (boy != attractive)          // She said 'my goodness no!'
    alert(window['boy']);       // And the boy through the window she hurled.
  • 5
    \$\begingroup\$ Creative and ingenious. \$\endgroup\$ Mar 6, 2014 at 7:49
  • 3
    \$\begingroup\$ There was no need to redefine girl on the second line but I still love it. \$\endgroup\$
    – howderek
    Mar 6, 2014 at 19:44


a = [
'hello world']
print ''.\


a equals open square bracket
quote hello world quote close square bracket
print quote quote dot backslash
join paren a hash hash
and finally close unmatched bracket

I'm voluntarily signing up to additional rules, because I think (1) that limericks should have good metre and (2) that the best ones have a surprise in the last line.

(With the ending being interpreted in plain English, I figure you can work out for yourself what kind of bracket is unmatched. As to the no dead code requirement, nothing in there can be removed without changing at least one of rhyme, rhythm or output).

  • \$\begingroup\$ One may remove a hash without changing functionality or rhyme. It does change the rhythm as you state, but the question‘s conditions are quite clear here, I think. \$\endgroup\$
    – Keba
    Mar 4, 2014 at 23:04
  • 1
    \$\begingroup\$ As the nature of poetry is to bend rules I can live with it. That said, it's not clear to me that metre isn't part of the OP's concept of rhyme anyway. \$\endgroup\$ Mar 4, 2014 at 23:21
  • 4
    \$\begingroup\$ Meh. Rhyming "bracket" with itself three times is just lazy limericking. \$\endgroup\$ Mar 6, 2014 at 15:30
  • \$\begingroup\$ Yeah, I feel bad about that. But it is a different symbol for each rhyme, as requested by OP. \$\endgroup\$ Mar 7, 2014 at 9:29


Taking some liberties with the pronunciation of certain symbols, i.e. Tuple construction (,,) and function application ($).

main = something that we wrote
     where something x y z = bloat
           bloat = flip ($) m putStrLn
           (that,we,wrote) = undefined
           m = "hello world"

The reading is supposed to be:

main is something that we wrote
where something x y z is bloat
bloat is flip apply m putStrLine
Tuple that we wrote is undefined
misquote hello world quote.


if (!!1) // and
  alert('&#10084; &#10084; the world') // and
Burn = $.cache
return 1 > his_parts.the_sum

If in brackets one follows exclaiming marks

and alert the world inside brackets after entity hearts

slash, slash and burn

equals cash, cash, return

one is greater than the sum of his parts

  • 3
    \$\begingroup\$ I don't think I know anyone who pronounces "$" as "cash," although I admit to not writing JavaScript. \$\endgroup\$ Mar 5, 2014 at 18:54
  • 1
    \$\begingroup\$ +1 I like the non-literal transcription, and "entity hearts" is kinda funny, despite the line break liberties. \$\endgroup\$
    – Jason C
    Mar 6, 2014 at 9:40


More specifically, Chipmunk Basic. The syntax rules have been stretched almost to breaking point, so it may be impossible to run this in other dialects without modification.


read hi$, u$, q
print hi$ " world how are you
  print "Or as they say
  print u$ q "day
data Hello, How R U, 2

"Read-aloud" version:

read hi string comma u string comma q
print hi string quote world how are you
  print quote Or as they say
  print u string q quote day
data Hello comma How R U comma 2


  • There are no line numbers in the source code, but it will still load and run without any problems (see below).
  • The $ sigil is read as "string" in the context of BASIC programs (see, e.g., this Wikipedia page).

And here's proof that it does actually work:

screen grab of program running in Mac OS X

  • \$\begingroup\$ How did you make this gif? \$\endgroup\$
    – Kartik
    Mar 6, 2014 at 7:09
  • \$\begingroup\$ @Kartik I used an app called IShowU \$\endgroup\$
    – r3mainer
    Mar 6, 2014 at 8:54


As the answer is only forced to contain the phrase "Hello World", the easiest solution should be:

echo A rhyming program you write
echo Attempting to win the fight
echo For winning the contest and vote
echo It must compute "Hello World"
echo Then print it very polite
  • 8
    \$\begingroup\$ Legal within the rules, but this answer is no fun at parties. meta.codegolf.stackexchange.com/a/1063/3363 \$\endgroup\$ Mar 4, 2014 at 16:56
  • 1
    \$\begingroup\$ @JonathanVanMatre That is a sign that the problem is in the question. Anything different than just directly printing the output would be suprefluous. Further the first "excluded" rule inhibit anything more creative, even variable names with more than one char and code identing, it is a code-golf evaluated as popularity-contest, getting the worst of the two. \$\endgroup\$ Mar 4, 2014 at 17:10
  • 4
    \$\begingroup\$ @Timtech: It‘s Vote and Quote. \$\endgroup\$
    – Keba
    Mar 4, 2014 at 17:42
  • 2
    \$\begingroup\$ Did you consider improving the question? / That might have made a better impression. / Though the damage is done / Wouldn't it be more fun / To make a real limerick-coding confection? :) \$\endgroup\$ Mar 4, 2014 at 18:08
  • 1
    \$\begingroup\$ @Victor, "characters which could be safely removed" does seem to imply that you can't use multi-character variable names except where they are part of a rhyme. That is problematic. \$\endgroup\$ Mar 4, 2014 at 18:11


public static void main(String[] boat
){ int i = 1.0f
("Hello world");} //hello world wrote

public static void main paren String arr boat
paren brace int i is one-point-oh float
sem-col if paren i is less than two
paren system dot out dot print line new //for some reason it's println, not printnl
paren quote hello world quote paren sem-col brace slash-slash hello world wrote

Note that comments are not really optional in Java

  • \$\begingroup\$ The b in "boat" needs to be removed ("oat' is a valid variable name, and fits) \$\endgroup\$ Aug 18, 2018 at 23:23


comma = ""<<44
print "Hello" or
more = ""<<32
print comma if true
puts("World!") unless print more

Live: https://ideone.com/sirBBc

Pronounced as follows (with stressed syllables capitalized)

comma Equals quote-QUOTE cons four-FOUR
print QUOTE hello END quote OR
more equals QUOTE quote cons three-TWO  # ok, that was squished
print COMma if TRUE
puts QUOTE world QUOTE UNless print MORE
  • \$\begingroup\$ The m and e in both instances of more needs to be removed (ore is a valid word in that position too) \$\endgroup\$ Aug 18, 2018 at 23:22
  • \$\begingroup\$ Hm, I don't think I can legally rhyme or with either or or ore. \$\endgroup\$
    – histocrat
    Aug 19, 2018 at 15:56
  • \$\begingroup\$ This wouldn't be the only example of a limerick with duplicate words \$\endgroup\$ Aug 19, 2018 at 16:34


main = print . repeat
  $ head $ lines . init
     $ "Hello \
       \World!" #
         Just where (#) = const . id

Main equals printful stop repeat
Dollar head dollar line's full stop i'nnit?
Dollar quote hello back slash
Back slashworld bang quote hash
Just where parenthised hash equals constful, stop it!

This describes, hopefully, quite well the actual behaviour of the program.



I apologize in advance, because this code does not count as a limeric if you pronounce the names of each of the individual symbols (especially if you treat each letter unto itself as a token, which perhaps you ought). I have written it this way to produce the nicest possible output, which itself comes just short of being a poem.

You could safely turn it into an answer which complies with the rules by getting rid of \it and every non-alphabetic, non-whitespace character except for the final \bye (read aloud as backslash bye) and perhaps the first ! (read aloud as bang).

A \TeX\ program I think would comply,

And I'll tell you the reason for why:

``Hello world!'' tells the setter:

{\it ``Print each subsequent letter!''}

And we terminate with \bye.
  • \$\begingroup\$ You should remove comas and symbols at the end of each verse to let them rhyme properly. Or put them in the line afterwards. \$\endgroup\$ Mar 6, 2014 at 12:07
  • \$\begingroup\$ @MikaëlMayer: see the remark in my second paragraph. \$\endgroup\$ Mar 6, 2014 at 12:54


Ok, chide me now for the numerous rule violations. But I couldn't help making this.


And the output (first violation of many: no space):


Try it here: http://www.iamcal.com/misc/bf_debug/

The reading of it:

Eight plus left more nine plus less dash
Right more dot three dash dot cash hash
Sevén plus dot dot plus
Plus plus dot eight plus
Dot eight dash dot three plus dot six dash dot eight dash.
  • Note that the final dot in the program is placed as the period at the end of the limerick :) [second violation; this is cheap]. Also, the $ and # are ignored by the interpreter (I was very proud of myself for this line).

  • The accent on Sevén is to show the stress: seh-VEN

  • This violates the rule of using different symbols. But honestly I have a very limited symbol set and no space to add in other (ignored) characters.

  • I used all caps because those are faster to access in ASCII. I had no room for a space, unfortunately.

Finally: yes, I know the last line is terrible. Any suggestions to improve it? I'm not sure if you could compress this program anymore; maybe by storing repeated letters in their at their own positions?

  • \$\begingroup\$ Just realized that while this would make the code longer, unrolling the initial loop into 72 + would save some space in the limerick. But I'll keep my answer as is. \$\endgroup\$
    – baum
    Mar 7, 2014 at 21:34


I've taken a few slight liberties with the rules as truly phonetic C variants would involve far too much use of "semi-colon" which, as we all know, isn't a particularly good rhyme for anything.

     string unfurled = "Hello World!";

open brace, string called unfurled

created to read "hello world"

console write line

the string we defined

a final brace, one that is curled

  • \$\begingroup\$ You can always put semi-colon at the beginning of a newline, no? \$\endgroup\$ Mar 10, 2014 at 12:46
  • \$\begingroup\$ True, Mikael, but it makes the code look very untidy! \$\endgroup\$ Mar 10, 2014 at 12:57
  • 1
    \$\begingroup\$ Between untidy and rhyming, here the point is about rhyming. Don't worry, this code is not peer-reviewed. \$\endgroup\$ Mar 10, 2014 at 14:00


class Hello {public static void main
(String[] args)
{yellow = System; yellow
world");} }

class Hello brace public static void main
paren string bracket bracket args paren
 brace yellow equals system sem-col yellow
 dot out dot print paren quote hello
world quote paren sem-col brace and brace again
  • 1
    \$\begingroup\$ This doesn't compile. How is yellow declared? \$\endgroup\$
    – nanofarad
    Mar 6, 2014 at 12:32


@echo off >dull
set /p "=Hello "<nul
set w=World
echo %w%! || Furled
del dull || cull

at echo off to dull
set slash p quote equal Hello quote from nul
set w equal World
echo percent w percent bang pipe pipe Furled
del dull pipe pipe cull

  • \$\begingroup\$ Can you find another rhyme dull/dull ? \$\endgroup\$ Mar 5, 2014 at 8:30
  • \$\begingroup\$ @MikaëlMayer it's more useless code, but yes. \$\endgroup\$
    – unclemeat
    Mar 5, 2014 at 21:27


,body lets go party
only a stylesheet,html
:after { content: 'hello world'; font-family:Rockwell
; color: #adad20


title greater than me

comma body lets go party

only a stylesheet comma html

colon after bracket content colon quote hello world quote semicolon font-family colon Rockwell

semicolon color colon hashtag a dad twenty

Tested in Firefox and Chrome

#include <stdio.h> //
void main (void){
printf("Hello, World");
//just for rhyme I say stolon
} /**/

hash include less than stdio dot h greater than double slash after a space

void main left paren void right paren left brace

printf left paren quote Hello comma World quote right paren semi colon

double slash just for rhyme I say stolon

right brace and double asterisk between slashes at the last place

  • \$\begingroup\$ Nice one for the first two rhymes, but you use twice the same symbol to rhyme (semi-colon), which is not allowed. \$\endgroup\$ Aug 5, 2016 at 9:34
  • \$\begingroup\$ Debugged, but I guess another bug appeared. \$\endgroup\$
    – Nayuta Ito
    Aug 6, 2016 at 23:42

Windows Batch

The spoken words are also saved within the batch file, and skipped with the last line of actual code.

@echo off >nul
set hi=Hello World
rem Now print the string,
echo !hi!
goto :) to skip the words

at echo off, greater than nul,
set H I equals sign, Hello World,
rem Now print the string,
echo pling, H I, pling
goto smile, to skip the words


Edit: You'll need delayed expansion enabled for the script to work. Use cmd /v:on and run it from there.

  • 1
    \$\begingroup\$ nul, world, and words do not rhyme. The pattern needs to be AABBA. Also the comma after string should be pronounced. \$\endgroup\$
    – unclemeat
    Mar 7, 2014 at 1:49

Python (3)

No punctuation hear close
Hello World
Hurled and swerled
Goodbye now''')

Print open quote quote quote nose, No punctuation hear close, Hello World, Hurled and swerled, Goodbye now quote quote quote close.

  • \$\begingroup\$ Welcome to the site, and nice first post! \$\endgroup\$ Nov 11, 2017 at 20:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.