Skip to content

Variables datatypes

Variables and Data Types

Variables

A Variable is a named container used to store data in memory. Think of it as a labeled box. - Name: The label on the box. - Value: The content inside the box.

Data Types

A Data Type tells the computer what kind of data is inside the box. This is important because you can do different things with different types (e.g., you can multiply numbers, but not names).

Common Data Types Across Languages:

Type Name Examples
Integer int 10, -5, 0
Float/Double float 3.14, -0.5, 2.0
String str "Hello", 'Python'
Boolean bool True, False

Logic First

In some languages (like Java/C), you must tell the box what it can hold forever. In others (like Python/JS), the box can hold anything and change anytime.