0% found this document useful (0 votes)
13 views3 pages

Programming Foundations Explained

This document provides an overview of programming, defining it as the process of giving instructions to a computer. It covers key concepts such as variables, data types, operators, conditional statements, loops, and functions, along with examples. Additionally, it introduces popular programming languages like Python, Java, JavaScript, and C++, and offers a simple guide to start programming.

Uploaded by

jonesmulonda96
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Programming Foundations Explained

This document provides an overview of programming, defining it as the process of giving instructions to a computer. It covers key concepts such as variables, data types, operators, conditional statements, loops, and functions, along with examples. Additionally, it introduces popular programming languages like Python, Java, JavaScript, and C++, and offers a simple guide to start programming.

Uploaded by

jonesmulonda96
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PROGRAMMING FOUNDATIONS — BITE■SIZED + EXPANDED

1. WHAT IS PROGRAMMING?
Programming is the process of giving instructions to a computer to perform tasks.
A program is a set of step-by-step commands that the computer follows.

Example:
• If you tell a computer: “Add 2 + 3,” you write code that performs that addition.

Real-life example:
• Following a cooking recipe is like running a program — step-by-step instructions.

-------------------------------------------------------------

2. KEY PROGRAMMING CONCEPTS (EXPANDED)

A. VARIABLES
A variable stores data that can change during program execution.
Think of a variable as a container (box) that holds information.

Examples:
x=5
name = "Stephen"
age = 20

Why it matters:
Variables help the program remember information.

-------------------------------------------------------------

B. DATA TYPES
Data types define the kind of information a variable stores.

Common types:
• Integer → whole numbers
• Float → decimal numbers
• String → text
• Boolean → True/False values

Example:
temperature = 36.7 (float)
isStudent = True (boolean)
school = "Unima" (string)

-------------------------------------------------------------

C. OPERATORS
Operators allow you to perform operations on data.

Types:
• Arithmetic (+, -, *, /)
• Comparison (==, >, <)
• Logical (and, or, not)

Example:
marks = 80
passed = marks > 50 # True

-------------------------------------------------------------
D. CONDITIONAL STATEMENTS
These allow the program to make decisions.

Example:
if age >= 18:
print("Adult")
else:
print("Minor")

-------------------------------------------------------------

E. LOOPS
Loops repeat actions.

Two types:
1. for loop → repeats a known number of times
2. while loop → repeats until a condition changes

Example:
for i in range(5):
print(i)

-------------------------------------------------------------

F. FUNCTIONS
A function is a reusable block of code.

Example:
def add(a, b):
return a + b

print(add(2, 3)) # 5

-------------------------------------------------------------

3. PROGRAMMING LANGUAGES (EXPANDED)

A. Python
• Simple, readable language
• Great for beginners
• Used in AI, data science, web apps

Example:
print("Hello world")

-------------------------------------------------------------

B. Java
• Strongly typed and structured
• Used for Android apps & enterprise systems

Example:
[Link]("Hello world");

-------------------------------------------------------------

C. JavaScript
• Runs in web browsers
• Used for interactive websites
Example:
[Link]("Hello world");

-------------------------------------------------------------

D. C++
• Fast and powerful
• Used for robotics, gaming, operating systems

Example:
cout << "Hello world";

-------------------------------------------------------------

4. HOW TO START PROGRAMMING (SIMPLE GUIDE)

Step 1: Choose one language (Python recommended)


Step 2: Install a code editor (VS Code recommended)
Step 3: Write small programs daily
Step 4: Build simple projects
Step 5: Practice consistently — 20 minutes daily is enough

-------------------------------------------------------------
END OF DOCUMENT

You might also like