Data Types
What are Data Types?
Data types define the kind of information a program can work with
Common Data Types
Three common data types are
- String – stores text like “Hello”, “Run!” and “123 Main Street”
- Integer – stores whole numbers like 1, 99 and -8
- Real/Float – stores decimal numbers – 10.5, 99.9 and -6.66
Why are Data Types Important?
They help the program know how to handle and store information
For example:
- A string is used for words or text
- An integer is used for counting or calculations without decimals
- A float is used for precise calculations like measurements
Understanding data types is key to writing clear and effective programs.
Data Type Summary
| Name | Example Data 1 | Example Data 2 | Purpose |
|---|---|---|---|
| String | "Hello" | "123 Alphabet Street" | Store text. |
| Integer | 9 | -7 | Store whole numbers. |
| Real/Float | 3.14 | -99.9 | Store decimal numbers. |