Data Types & Variables

Data Types

Different types of data that can be stored and processed in programs.

Type Description Examples
IntegerWhole numbers (no decimals)42, -7, 0
Real/FloatDecimal numbers3.14, -2.5
BooleanTrue or False valuestrue, false
CharacterSingle letter or symbol'A', '5', '@'
StringText (sequence of characters)"Hello World"

Variables

Named storage locations that hold data which can change during program execution.

Naming Conventions

  • Use meaningful, descriptive names (studentName, totalScore)
  • Start with a letter (not a number)
  • No spaces - use camelCase or underscores
  • Avoid reserved words (if, while, for)

Examples in Pseudocode

// Declaring and assigning variables
studentName ← "John Smith"
studentAge ← 17
isPassing ← true
averageScore ← 85.5
        

Constants

Values that don't change during program execution. Named in UPPERCASE by convention.

CONST TAX_RATE ← 0.10
CONST MAX_STUDENTS ← 30