Member-only story
Coding 101: CS Variables Simplified
This article will try to simply the concept of variables in computer science programming. Imagine you are cleaning out your garage. You buy bags to help you organize everything. You can think of these as variables.
You put things of similar types into the same bag. You then label the bag so you know what type of items are in it.
Variables are simply locations of storage that hold information that you can use later.
Data Types
Just how you would label the different bags with names, you would label the variables with names called a data type.
Just like the bag label defines the things going into the bag, the data type defines the type of information that a variable could hold. Depending on the programming language that you use, you will see many different types of predefined data types such as “string”, “integer”, “character”, “Boolean”, “double”, and “float” for Java.
Declaring a variable
Before you can use a variable, you must declare it. See the below format.