First coding classes

What are variables for the first time

Hey @WilsonLoleo welcome to the forums!

Could you please provide more information on what you are asking for? It would help us out a lot, thanks! Hope you have a great day :grinning:!

Variables store information, such as numbers and strings. They’re very useful in things like these:

For example, say you want to print out “hello world hello world” 3 times. When loops would be better for this, let’s just pretend they don’t exist.

(Note that this code is in the Python programming language)

Without variables:

print("hello world hello world")
print("hello world hello world")
print("hello world hello world")

With variables:

string = "hello world hello world"


As you can see, it’s a lot easier with variables. Instead of just repeatedly placing “hello world hello world” in the prints, you can just place the variables in there.

Note that a better approach to repeating prints are loops.


Variables are objects that can store information. These variables can store a huge variety of different types of information.
Here’s a list to name a few:

  1. Integers. Integers store basic whole numbers, like 1, 2, 3, 4, and 5, they also be negative as well.
  2. Float. Float numbers store decimal numbers. like 1.5, 7.8, and 3.3. Note that when you divide an integer by a number, it’s result is automatically a float number.
  3. String. Strings hold text, like letters in the alphabet. A string can also print out numbers, but in its text form instead of the number itself. So you cannot add 5 + “5”.
  4. Boolean. Booleans can either be True, or False. Booleans are commonly used in if statements and while loops.
  5. Arrays/lists. An array can store several kinds of information in a single variable. arrays would look something like this:
array = ["Yogurt", 10, 3.5, -20]

Variables are one of the key elements in creating a program, although you can still code without using variables it would be very hard to make it useful in other scenarios.

If you want to learn more about variables, there are plenty of resources online to help guide you and teach you everything you want to know about them. I hope this helps!