In order to create our own code, we need to understand the foundations of programming so that we can build upon it.
Code is made up of the following main components:
Variables
Data types
Operators (also known as expressions)
Functions (also known as methods)
Comments
Library import variables
When programming, we make use of variables to store both known and unknown information in the form of values and identifiers in named locations in memory.
For instance, we could store the name of the main character in our game in a variable, as shown in the following line of code:
Name = Hercules
Name
is the variable's identifier, and Hercules
is the stored value assigned to the variable Name
.