Skip to content

Instantly share code, notes, and snippets.

@dotcomboom
Last active August 19, 2020 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotcomboom/bd6c79c7149eff2e332b96dc0def4c25 to your computer and use it in GitHub Desktop.
Save dotcomboom/bd6c79c7149eff2e332b96dc0def4c25 to your computer and use it in GitHub Desktop.
99 Bottles of Beer on the Wall (E sample program)
Checkpoint Start.
<-- Defines a checkpoint named Start. You can go back to it with Goto, as seen on line 13. Also, every operation ends with a period.
Set Drink to "Dr. Pepper".
Set Bottles to 0.
<-- This sets the variable Bottles. Variables store values.
<-- Similarly to other languages, quotes around text makes them a string (string of characters, or text)
Add 99 to Bottles.
<-- Add 99 bottles. (Shown here as an example. You could just Set Bottles to 99.)
Checkpoint TakeOneDown.
Yell "@Bottles bottles of @Drink on the wall, @Bottles bottles of @Drink.".
<-- @ behind a variable name will format it into a string.
Subtract 1 from Bottles. <-- Subtract builtin.
Yell "Take one down, pass it around, @Bottles bottles of @Drink on the wall."
<-- FYI: If you need to write an email address or something it needs to be escaped like \@.
Is Bottles over 0? Goto TakeOneDown.
Yell "No more bottles of @Drink on the wall, no more bottles of @Drink."
Yell "Go to the store and buy some more, 99 bottles of @Drink on the wall..."
<-- If we wanted to make this neverrending, we can just do:
<-- Goto Start.
<-- Also yea comments can be at the end of a line, it just gets messy without syntax formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment