Learn
Variables
Introduction to Variables

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 input that the user of the program gives, rather than just outputting the same thing every time.

For our computer to produce something meaningful, we first need somewhere in the computerโ€™s memory to store data. That is where variables come in.

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.

Every variable has a type, which represents the kind of information you can store inside of it. It tells your compiler how much memory to set aside for the variable, and it defines what you can do with the variable.

We wonโ€™t dive into types in Emojicode, but just know that there are a few basic data types:

  • ๐Ÿ”ข: integer numbers
  • ๐Ÿ’ฏ: decimal numbers
  • ๐Ÿ”ก: text strings
  • ๐Ÿ‘Œ: truth values (๐Ÿ‘/๐Ÿ‘Ž)

In this lesson, we will learn about constants and mutable variables, as well as ways to play with them.

Instructions

To understand the different types of data in Emojicode, take a look at the table on the right.

Press Next to continue.

Folder Icon

Take this course for free

Already have an account?