Variables and How to Use Them

In programming, a variable is a type of information storage. Data can be stored in a variable, and then called on later in the code to access that data. Say for example, I wanted to store my name as a variable, I could create something like this;

public string myName = “Ken”;

So what does all of that mean? Well, “public” means that other parts of the program can access it if told to, the other option here is “private”, where it can only be accessed by the script it is located within.
String refers to the type of variable. A string is a series of ASCII characters contained within quotation marks. There are several other types of popular variable types, including bool (true/false), int (whole number), and float (decimal number).
The name of the variable is myName. Variable names use camel case, where the first letter of the first word is lower case, but the first letter of each subsequent word is uppercase. If I wanted to access the data contained within, I would have a function call on myName to access the data.
Lastly, the variable is pointed at the data it will be storing with the equals sign. In this case, the data it holds is the string “Ken”.

Variables can also be assigned to accept user input to define the data contained within. For example, as part of the Space Shooter Pro assignment, I have created a series of variables that map keystrokes to player movement.

Next, I will be discussing the importance of using pseudocode.