Programming Fundamental
Programming Fundamental
fundamentals
This Cheat Sheet covers key concepts across
most programming languages like Python, Java,
C++, and JavaScript.
syntax
Set of rules that defines how
programs must be written in a
programming language.
Data type
Categories of data e.g., int,
integer, float, character, float
boolean, string
variable
Named storage locations used
to hold values that can change
during program execution.
condition
Used to perform different
if else
actions based on different
conditions
Loops
A way to repeat a block of for
code multiple times. while
function
Blocks of reusable code that
perform a specific task
when called.
arrays / Lists
Ordered collections of elements
that can be accessed using
indices.
Programming
fundamentals
The key concepts are explained using the
syntax of Python programming language.
syntax
print("Hello") output
Data type
int, float, double
char
bool, text
variable
x = 10
name = "Alice"
gpa = 3.4
condition
if x > 0:
print("Positive") if else
else:
print("Negative")
Loops
for x in range(x):
for
statement(s)
while condition: while
statement(s)
function
def greet(name):
return "Hello " + name
arrays / Lists
nums = [1, 2, 3]
nums[0] = 10
Programming
fundamentals
The key concepts are explained using the Java
Script examples.
syntax
console.log("Hello"); output
Data type
int, float, char
bool, string
variable
let x = 10;
let name = "Alice";
let pi = 3.14;
condition
if (x > 0) {
console.log("Positive"); if else
} else {
console.log("Non-positive");}
function
function square(x) {
return x * x;
}
arrays / Lists
let nums = [1, 2, 3];
console.log(nums[0]);
Programming
fundamentals
The key concepts are explained using the
examples of C++.
syntax
cout << "Hello, world!"; output
Data type
int, float, char
bool, string
variable
int x = 10;
string name = "Alice";
float pi = 3.14;
condition
if (x > 0) {
cout << "Positive"; if else
} else {
cout << "Non-positive";}
function
int square(int x) {
return x * x;
}
arrays / Lists
int nums[ ] = {1, 2, 3};
cout << nums[0];