1. **Variables** � Containers for storing data.
Example in JavaScript:
```js
let name = "Federico";
let age = 30;
console.log("Name:", name, "Age:", age);
```
This declares two variables and prints them.
2. **Data Types** � Different kinds of data you can work with.
Example in Python:
```python
name = "Alice" # String
age = 25 # Integer
is_student = False # Boolean
```
Each variable holds a different type of data.
3. **Conditionals** � Making decisions in your code.
Example in C#:
```csharp
int age = 18;
if (age >= 18)
{
Console.WriteLine("You are an adult.");
}
else
{
Console.WriteLine("You are a minor.");
}
```
This checks the value of `age` and runs different code accordingly.
4. **Loops** � Repeating actions efficiently.
Example in JavaScript:
```js
for (let i = 0; i < 5; i++) {
console.log("Iteration:", i);
}
```
This runs five times, printing the iteration number.
5. **Functions** � Blocks of reusable code.
Example in Python:
```python
def greet(name):
return "Hello, " + name + "!"
print(greet("Federico"))
```
This function takes a name and returns a greeting.
6. **Arrays & Lists** � Storing multiple values in a collection.
Example in JavaScript:
```js
let fruits = ["Apple", "Banana", "Cherry"];
console.log(fruits[1]); // Outputs "Banana"
```
This creates an array and accesses an element.
7. **Classes & Objects (OOP)** � Organizing code using objects.
Example in C#:
```csharp
class Car {
public string Brand;
public int Year;
public void Honk() {
Console.WriteLine("Beep Beep!");
}
}
Car myCar = new Car();
myCar.Brand = "Toyota";
myCar.Year = 2020;
myCar.Honk();
```
This defines a class and creates an object.