Variables

Get introduced to variables and learn how to declare them in Dart.

What are variables?

Variables are used for storing information which can then be used by the computer program. Let’s look at this concept from a different angle.

Imagine you’re building a wooden bookshelf and need planks of wood, nails, and different tools to finish your project. To better organize the material, you decide to group similar items together and store them in boxes. This would allow you better access to each item depending on which item you need and when you need it. You have one box with planks, another with nails, and another with tools. However, there’s a problem; you have multiple types of planks, nails, and tools. You have to sort through the right type of box to get the required item. You decide to further divide each box. Multiple boxes can store the same type of item, such as wooden planks, but each box is still unique. There are now two boxes for wooden planks; one with wide planks and another with narrow planks. When you’re done dividing all the material into separate boxes, you end up with an abundance of boxes and can’t seem to find what you’re looking for. Finally, you label each box with a unique name to make each one easier to identify. You now have an organized way to store your material and access it whenever you want.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy