FiM++ Wiki
Register
Advertisement

The Jugs of Cider program is a good one for testing the syntax of a complete program. The goal is to print out the 99 Jugs of Cider song. The below implementation includes an import, a superclass, an implemented interface, multiple methods, variables, literals, different types of nested branching statements, and comments.

Example[]

Remember when I wrote about Applejack? (I don't!)

Dear Princess Cadence and Shining Armor: Cider Jugs.

Today I learned Applejack's Drinking Song.
Did you know that Applejack likes the number 99? (Applejack likes a lot of things...)
I remembered how to sing the drinking song using Applejack.
That's all about Applejack's Drinking Song!



I learned how to sing the drinking song using the number ciders.
As long as ciders were more than 1.
I sang ciders" jugs of cider on the wall, "ciders" jugs of cider,".
There was one less ciders.
When ciders had more than 1, I sang "Take one down and pass it around, "ciders" jugs of cider on the wall."!
Otherwise, I sang "Take one down and pass it around, 1 jug of cider on the wall."!
That's what I would do, That's what I did.

I sang "1 jug of cider on the wall, 1 jug of cider.
Take it down and pass it around, no more jugs of cider on the wall.

No more jugs of cider on the wall, no more jugs of cider.
Go to the celler, get some more, 99 jugs of cider on the wall."
.
That's what I did.
That's all about how to sing the Drinking Song!

Your faithful student, Twilight Sparkle.

P.S. Twilight's drunken state truely frightened me, so I couldn't disregard her order to send you this letter. Who would have thought her first reaction to hard cider would be this... explosive? I need your advice, your help, everything, on how to deal with her drunk... self. -Spike

As a Scroll[]

Here's the same program written for Layman's readability:

Remember when I wrote about Applejack? (I don't!)

Dear Princess Cadence and Shining Armor: Cider Jugs.

Today I learned Applejack's Drinking Song. Did you know that Applejack likes the number 99? (Applejack likes a lot of things...) I remembered how to sing the drinking song using Applejack. That's all about Applejack's Drinking Song!

I learned how to sing the drinking song using the number ciders. As long as ciders were more than 1, I sang cider" jugs of cider on the wall, "cider" jugs of cider,". There was one less cider. When cider had more than 1, I sang "Take one down and pass it around, "cider" jugs of cider on the wall."! Otherwise, I sang "Take one down and pass it around, 1 jug of cider on the wall."! That's what I would do, That's what I did.

I sang "1 jug of cider on the wall, 1 jug of cider. Take it down and pass it around, no more jugs of cider on the wall. No more jugs of cider on the wall, no more jugs of cider. Go to the celler, get some more, 99 jugs of cider on the wall.". That's what I did! That's all about how to sing the Drinking Song!

Your faithful student,
Twilight Sparkle.

P.S. Twilight's drunken state truely frightened me, so I couldn't disregard her order to send you this letter. Who would have thought her first reaction to hard cider would be this... explosive? I need your advice, your help, everything, on how to deal with her drunk... self. -Spike


See Also[]

Advertisement