A programmer started to cuss,

Because getting to sleep was a fuss.

As he lay there in bed,

Looping ’round in his head,

Was: while(!asleep()) sheep++;

I don't know where to put this query so I put it here

closed as off-topic by tchrist, TimLymington, Matt E. Эллен, MrHen, David M Apr 7 '14 at 23:58

  • This question does not appear to be about English language and usage within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    This question appears to be off-topic because it is about explaining a programmer joke. – tchrist Apr 6 '14 at 18:41
  • 1
    @tchrist: Software and those who build it are so important and commonplace today, that perhaps programmers' lingo can be considered a dialect of English. (This site is produced by some very good programmers...) – Vector Apr 6 '14 at 19:28
  • @comeAndGo That's like saying that a lot of people speak French. Hence, French should be incorporated into English. Programmers write in languages not dialects... Oh, and tchrist is a programmer! – David M Apr 7 '14 at 23:57
  • @DavidM - ridiculous discussion. We speak English in my shop. – Vector Apr 8 '14 at 16:13

This kind of verse is called a limerick

...a short, humorous, often ribald or nonsense poem, especially one in five-line anapestic meter with a strict rhyme scheme (AABBA), which is sometimes obscene with humorous intent. The first two lines rhyme with the last line and the third and fourth line rhyme, and they are usually shorter. The form can be found in England as of the early years of the 18th century. It was popularized by Edward Lear in the 19th century, although he did not use the term.

The last line ends plus plus which rhymes with cuss and fuss, and the humour comes from it being programming language.

Also, counting sheep in your head is supposed to be a way of falling asleep if you are having trouble.

while(!asleep()) sheep++;

This means he was counting sheep and apparently couldn't fall asleep.

In programming, a 'while' loop goes on forever until some condition is no longer true. In this case, the condition is !asleep() which is a function call to check if he is sleeping or not. The '!' is a logic operator which means 'not'. Since he is still awake, asleep() returns false and the ! sign negates false, making it true. If he were asleep then asleep() would return true and the ! sign would flip that, making the condition in the while loop false and then break the loop.

Inside the loop, a sheep variable is being incremented by the ++ operator. So, the sheep variable may start at 1 and in each iteration the number is incremented by 1. ++ really means sheep = sheep + 1.

  • It might work better in binary. – Edwin Ashworth Apr 6 '14 at 21:34
  • @EdwinAshworth It's better in the original MIX. – Elliott Frisch Apr 6 '14 at 22:30
Looping ’round in his head,
Was: while(!asleep()) sheep++;


He kept saying to himself,  
As long as I'm not asleep, I'll keep counting sheep.

The last line

Was: while(!asleep()) sheep++;


Was: while not asleep increment sheep

the rhyme comes from asleep and sheep. It is a very simple loop; he is incrementing sheeps in his imagination so he can fall asleep.

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