Variables
Lesson 1 of 1
  1. 1
    The “Hello, world!” program simply writes to the screen. It does not read anything, calculate anything, or allow for user input. That’s no fun! Real programs tend to produce results based on some …
  2. 2
    Suppose we are building a game, and we want to keep track of the item names and their in-game prices. We need some variables! In many cases, you will only assign a variable once, i.e. store a valu…
  3. 3
    So now you might ask, how do we print the value of a constant to the terminal? Oftentimes, we find ourselves needing to print constant values as part of a message in the terminal. In these cases, w…
  4. 4
    Computers are incredible at doing calculations. Now that we have declared variables, let’s use them with arithmetic operators to calculate things! Emojicode supports arithmetic operators for: - ➕…
  5. 5
    Sometimes in our programs, however, we need variables whose values can be modified. If you try to reassign a constant variable, this will result in a compiler error. This is where mutable variabl…
  6. 6
    In Emojicode, operator assignment provides a short-hand method for modifying the value of variables. Different compound assignment operators include: - ⬅️➕: addition assignment - ⬅️➖: subtractio…
  7. 7
    You made it to the end of the lesson! High five. 🙌 Here is a review of the lesson: - A variable represents a particular piece of your computer’s memory that has been set aside for you to use to s…

What you'll create

Portfolio projects that showcase your new skills

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory