# Limerick Hello World [closed]

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".

• 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? Mar 5 '14 at 11:10
• 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. Mar 5 '14 at 12:21
• 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.
– TRiG
Jul 2 '14 at 11:22
• That's true. I only want the program to be a limerick. Jul 2 '14 at 12:39
• I'm voting to close this as too broad because there is no way to objectively determine if an answer is valid. Nov 11 '17 at 20:01

## Whitespace

A rhyming program I	wrote

this poem of whitespace and bloat

because newlines don't count

despite the amount

so deserves your sincerest upvote



Output:

Hello World

• This somehow reminds me of the Beatles' Come Together. Mar 4 '14 at 20:54
• It's certainly "over me" Mar 4 '14 at 23:52
• Excluded: Using comments as a way to rhyme Mar 5 '14 at 17:23
• 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. Mar 5 '14 at 18:15
• @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. Mar 6 '14 at 9:35

HTML

<html>
<body><span
class="poem"
> 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
-->

• +1 for clever re-pronunciations... + "Bang, I'm a goat" comment... Mar 4 '14 at 22:32
• +1 for reading >< as "not equal" Mar 5 '14 at 18:42
• 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. Mar 6 '14 at 14:44

## Javascript

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.

• Creative and ingenious. Mar 6 '14 at 7:49
• There was no need to redefine girl on the second line but I still love it. Mar 6 '14 at 19:44

Python

a = [
'hello world']
print ''.\
join(a##
)


or,

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).

• 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.
– Keba
Mar 4 '14 at 23:04
• 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. Mar 4 '14 at 23:21
• Meh. Rhyming "bracket" with itself three times is just lazy limericking. Mar 6 '14 at 15:30
• Yeah, I feel bad about that. But it is a different symbol for each rhyme, as requested by OP. Mar 7 '14 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.


## JavaScript

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 • I don't think I know anyone who pronounces "$" as "cash," although I admit to not writing JavaScript. Mar 5 '14 at 18:54
• +1 I like the non-literal transcription, and "entity hearts" is kinda funny, despite the line break liberties. Mar 6 '14 at 9:40

# BASIC

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.

Source:

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 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


Notes:

• 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: • How did you make this gif? Mar 6 '14 at 7:09 • @Kartik I used an app called IShowU Mar 6 '14 at 8:54 Bash 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  • Legal within the rules, but this answer is no fun at parties. meta.codegolf.stackexchange.com/a/1063/3363 Mar 4 '14 at 16:56 • @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. Mar 4 '14 at 17:10 • @Timtech: It‘s Vote and Quote. – Keba Mar 4 '14 at 17:42 • 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? :) Mar 4 '14 at 18:08 • @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. Mar 4 '14 at 18:11 ## Java public static void main(String[] boat ){ int i = 1.0f ;if(i<2 )System.out.println ("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 • The b in "boat" needs to be removed ("oat' is a valid variable name, and fits) Aug 18 '18 at 23:23 # Ruby comma = ""<<44 print "Hello" or more = ""<<32 print comma if true puts("World!") unless print more  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  • The m and e in both instances of more needs to be removed (ore is a valid word in that position too) Aug 18 '18 at 23:22 • Hm, I don't think I can legally rhyme or with either or or ore. Aug 19 '18 at 15:56 • This wouldn't be the only example of a limerick with duplicate words Aug 19 '18 at 16:34 ## Haskell 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.

## TeX

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.

• You should remove comas and symbols at the end of each verse to let them rhyme properly. Or put them in the line afterwards. Mar 6 '14 at 12:07
• @MikaëlMayer: see the remark in my second paragraph. Mar 6 '14 at 12:54

# Brainf*ck

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): HELLOWORLD  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?

• 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.
– baum
Mar 7 '14 at 21:34

C#

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!";
Console.WriteLine(unfurled);
}


open brace, string called unfurled

console write line

the string we defined

a final brace, one that is curled

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

# Java

class Hello {public static void main
(String[] args)
{yellow = System; yellow
.out.print("Hello
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

• This doesn't compile. How is yellow declared? Mar 6 '14 at 12:32

## Batch

@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

• Can you find another rhyme dull/dull ? Mar 5 '14 at 8:30
• @MikaëlMayer it's more useless code, but yes. Mar 5 '14 at 21:27

# CSS

title>me
,body lets go party
only a stylesheet,html
:after { content: 'hello world'; font-family:Rockwell


Outputs:

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

• Nice one for the first two rhymes, but you use twice the same symbol to rhyme (semi-colon), which is not allowed. Aug 5 '16 at 9:34
• Debugged, but I guess another bug appeared. Aug 6 '16 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.

• nul, world, and words do not rhyme. The pattern needs to be AABBA. Also the comma after string should be pronounced. Mar 7 '14 at 1:49

Python (3)

print('''Nose
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.

• Welcome to the site, and nice first post! Nov 11 '17 at 20:11

print 'the letter keys on my keyboard'
print 'are sufficient to say Hello World
print 'when I type in the dark'
print 'sitting here in the park'
print'feeling horribly,horribly bored'

• Note the rules: symbols such as ' are read aloud and count as part of the rhyming scheme. Welcome to PPCG! Mar 6 '14 at 23:54
• So technically it works. It doesn't say A cannot be B. Mar 10 '14 at 13:42