In this article, I'll cover the greatest coding language to learn how to make anything! It's called Emojicode. Created in 2014 by Theo Belaire, Emojicode is an open source programming language that uses emoji characters to represent its syntax. When working in Emojicode, emoji are used to create variables, functions, and control structures. Because it's a statically typed language, variable types must be declared before use, but it also supports object-oriented concepts like classes and inheritance. This language can be run on every OS, and it's a super fun way to code, especially if you're a non-native English speaker. This is helpful because pictographic representations can bring us all together and allow us to speak the same language in a way similar to math.
In this tutorial, I'm using a Debian-based OS. My tools may be different than what your OS may require. Here's what I'm using:
- Geany, an open source IDE for Linux.
- IBus, which allows you to pick emoji and place them in your editor. The interface I'm using is called emoji picker.
- Debian-based Linux.
- A C++ compiler. I'm using the
I'm using a Linux OS, but you can read the docs to learn about any special steps you might need to take to use it on another OS.
Install Emojicode on Linux
There are a couple ways to install Emojicode on your computer, but they have a cool magic install page that can tell you exactly what to do. Here's what I did:
$ wget https://github.com/emojicode/emojicode/releases/download/v1.0-beta.2/Emojicode-1.0-beta.2-Linux-x86_64.tar.gz -O emojicode.tar.gz \ && tar -xzf emojicode.tar.gz && rm emojicode.tar.gz \ && cd Emojicode-1.0-beta.2-Linux-x86_64 && ./install.sh \ && cd .. && rm -r Emojicode-1.0-beta.2-Linux-x86_64
This is the output of that command.
Now that you have everything installed, it's time to move on to some code!
How does this whole thing work?
To start, all Emojicode file extensions end in filename.🍇 but because you can't do that in your average file name, it translates to
filename.emojic. Here are the most important syntax elements:
- Put 🏁 at the beginning of a line to indicate what blocks of code are meant to be executed
- Start a block of code with 🍇
- End a block of code using 🍉
- Want to print something? Just use 😀 🔤
There's way more to it, so here are some practical examples.
Print a haiku
First up, try printing a nice haiku for fun! I'll add a single comment in this example. See if you can identify it.
🏁🍇 💭 This is a single line comment for fun 😀 🔤Emojicode is great,🔤 ❗ 😀 🔤Fun and expressive code,🔤 ❗ 😀 🔤no sadness, just joy.🔤 ❗ 🍉
Now we need to save our code and run it through our compiler to make a nice executable file:
$ emojicodec haiku.emojic $ ls haiku haiku.emojic haiku.o
As you can see, the code has been compiled and generated two files, one of which is executable. Run the
$ ./haiku Emojicode is great, Fun and expressive code, no sadness, just joy.
Math and variable manipulation
Next up, you're going to do a couple of things at once: a little bit of math and the changing of the variable. Start by assigning a variable to 0:
0 ➡️ 🖍🆕x
You just created a new variable by using the crayon emoji, and the new emoji next to the variable name, while also assigning that variable to 0.
Next, print a line that includes the variable using the magnets emoji:
😀 🔤The value is 🧲x🧲 🔤 ❗
Next, change the variable using the plus sign and arrow emojis:
x ⬅️➕ 1
Then print another line with the value. I continue this for a while and print the final value. Here's what I did:
🏁 🍇 💭Updating a variable using math 0 ➡️ 🖍🆕x 😀 🔤The value is 🧲x🧲 🔤 ❗ x ⬅️➕ 1 😀 🔤The value is 🧲x🧲 🔤 ❗ x ⬅️➕ 15 😀 🔤The value is 🧲x🧲 🔤 ❗ x ⬅️➖ 9 😀 🔤The value is 🧲x🧲 🔤 ❗ x ⬅️➗ 2 😀 🔤The final value is 🧲x🧲 🔤 ❗ 🍉
Next, compile the code using
emojicodec, and then use your executable code to see the outcome:
$ emojicodec math.emojic $ ./math The value is 0 The value is 1 The value is 16 The value is 7 The final value is 3
As you can see, everything printed out as the variable was updated with the new math. You can take this even further with the many mathematic emojis available. Here are just a few more operators:
🚮 is your modulo ◀ Less than ▶ Greater than ◀🙌 less than or equal to ▶🙌 greater than or equal to
While I was bouncing around the docs, I found some interesting quirks. One of those is that while grabbing input from a user, the skin tone of the ear matters due to some known compiler issue.
The action for getting user input is this:
The action for getting and assigning user input is this:
🆕🔡▶️👂🏼❗️ ➡️ inputText
I was attempting to get that to work but was having some issues with my compiler when I found that. You may also run into some small things here and there. If you do, be sure to create an issue, so it has a chance of being fixed.
No tricks, just great code
While I could go through so much more, I can assure you the docs behind this amazing code are very extensive. Even though I was inspired to write this article just for fun in time April Fool's Day, I have to admit this is one of the best languages ever made because it teaches you a lot about very real programming concepts. I earnestly suggest this as a fun way to teach some of your friends, kids, or maybe a classmate, who is interested in coding. Hopefully, you have a fun-filled April Fool's Day!