Skip to content

Understanding data types is fundamental to programming. Different types of data are stored and processed differently by computers.

Definition
Primitive data types are the basic building blocks for storing data in programs. They define what kind of data a variable can hold and what operations can be performed on it.

Integer

Definition
An integer is a whole number, positive or negative, with no decimal point.
Example
Valid integers: 42, -17, 0, 1000000
NOT integers: 3.14, "42", 5.0

Real (Floating Point)

Definition
A real number (or float) is a number that can have a fractional part, represented with a decimal point.
Example
Valid reals: 3.14, -0.5, 100.0, 2.71828

Boolean

Definition
A Boolean can only have two values: True or False. Used for logical operations and conditions.
Example
isLoggedIn = True
hasPermission = False
isAdult = age >= 18 // Result is True or False

Character

Definition
A character is a single symbol - a letter, digit, punctuation mark, or special symbol.
Example
Valid characters: 'A', 'z', '7', '!', ' '
Each character has a numeric code (ASCII/Unicode)

String

Definition
A string is a sequence of characters, used to represent text.
Example
name = "Alice Smith"
empty = ""
number = "42" // This is a STRING, not an integer!
Key Point
Integer
• Description: Whole numbers
• Example: 42, -7, 0

Real/Float
• Description: Decimal numbers
• Example: 3.14, -0.5

Boolean
• Description: True or False
• Example: True, False

Character
• Description: Single symbol
• Example: 'A', '7'

String
• Description: Text
• Example: "Hello"