Programming Basics
Learn the core concepts every programmer needs to know — variables, loops, functions, and how to think like a computer.
What is Programming?
Programming is the process of writing instructions that a computer can understand and execute. These instructions are written in a programming language — a formal language with specific syntax and rules.
A program is like a recipe: step-by-step instructions that, when followed precisely, produce a desired result.
Core Concepts
Variables & Data Types
A variable is a named storage location in memory. Every variable holds a value of a specific data type:
- Integer — Whole numbers (e.g.,
42,-7) - Float — Decimal numbers (e.g.,
3.14) - String — Text (e.g.,
"Hello, World!") - Boolean — True or False values
- Array / List — An ordered collection of values
Operators
- Arithmetic:
+,-,*,/,%(modulo) - Comparison:
==,!=,<,>,<=,>= - Logical:
AND,OR,NOT
Control Flow
Programs don't always run top-to-bottom. Control flow lets you make decisions and repeat actions:
- if / else — Run code only when a condition is true.
- for loop — Repeat code a fixed number of times.
- while loop — Repeat code as long as a condition holds.
- switch / match — Choose between multiple paths based on a value.
Functions
A function is a reusable block of code that performs a specific task. Functions accept parameters (inputs) and return a value (output). They make code organized, readable, and DRY (Don't Repeat Yourself).
Input & Output
Programs interact with the world through I/O:
- Input — Keyboard, mouse, files, network, sensors
- Output — Screen display, files, network requests, audio
Programming Paradigms
- Procedural — Step-by-step instructions (C, Pascal)
- Object-Oriented (OOP) — Organizes code into objects with data and behavior (Java, Python, C++)
- Functional — Treats computation as mathematical functions (Haskell, Erlang)
- Declarative — Describes what to do, not how (SQL, HTML)
Popular Programming Languages
- Python — Beginner-friendly, widely used in AI/data science
- JavaScript — The language of the web browser
- Java — Enterprise apps, Android development
- C/C++ — System programming, game engines, performance-critical apps
- SQL — Querying databases
What's Next?
Ready to start writing code? Try our Python Tutorial for beginners, or learn about Algorithms to understand how to solve problems efficiently.