Part 2 of the Series on Emojicode.
Let's dive deep into coding with emojis.
In this part, I'll try to introduce you to what variables are and how are they implemented in Emojicode 💪.
Variable 🙄❓
A variable is simply a name that represents a particular piece of your computer’s memory that has been set aside for you to store, retrieve, and use data.
Variable store data types. We had a small introduction to strings in the last part - which is a data type!
Data types are just to tell computer what type of data it is.
Declaring and Assigning Variables:
Emojicode lets you declare two types of variables:
Declaring a constant variable:
🔤Earth🔤 ➡️ planet
💭🔜 planet is variable, ➡️ is assigning operator,  Earth is a string and is the value of planet variable 🔚💭
Declaring a mutable variable:
6 ➡️ 🖍🆕 coins
💭🔜 coin is a variable, ➡️ is assigning operator,  6 is an integer and is the value of coin variable, 🖍🆕 means mutable 🔚💭
💭 Mutable variables *need* to be mutated or emojicode will smash an error on you.
String Interpolation (printing your variable):
Just declaring variable is boring 🥱, we need to print them out.
To print variables, we need to wrap them around 🧲.
Arithmetic Operations:
| Emoji | Operation | Example | 
|---|---|---|
| ➕ | addition | 2 ➕ 2 ➡️ number 💭 number is 4 | 
| ➖ | subtraction | 2 ➖ 2 ➡️ number 💭 number is 0 | 
| ✖️ | multiplication | 2 ✖️ 2 ➡️ number 💭 number is 4 | 
| ➗ | division | 2 ➗ 2 ➡️ number 💭 number is 1 | 
| 🚮 | modulo | 2 🚮 2 ➡️ number 💭 number is 0 | 
Mutate the mutables 😎! Operator Assignments.
In Emojicode, operator assignment provides a short-hand method for modifying the value of variables.
Suppose we have a variable like this:
2 ➡️ 🖍🆕 mutate   💭 mutate is 0
| Emoji | Operation | Example | 
|---|---|---|
| ⬅️➕ | addition assignment | mutate ⬅️➕ 1 💭 mutate is now 3 | 
| ⬅️➖ | subtraction assignment | mutate ⬅️➖ 1 💭 mutate is now 2 | 
| ⬅️✖️ | multiplication assignment | mutate ⬅️✖️ 2 💭 mutate is 4 | 
| ⬅️➗ | division assignment | mutate ⬅️➗ 2 💭 mutate is now 2 | 
| 🚮 | modulo assignment | 
Let's code a program 💻
This is a very basic program. Pardon me if you are hecker 😁
              



    
Top comments (1)
Nice series. I'm wondering if I can build a real-world program using emojicode 😂