0% found this document useful (0 votes)
3 views

Programming concepts class1

The document outlines fundamental programming concepts including variables, data types, conditionals, loops, functions, arrays, and object-oriented programming. Each concept is illustrated with examples in various programming languages such as JavaScript, Python, and C#. It serves as a concise guide for understanding basic coding principles.

Uploaded by

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

Programming concepts class1

The document outlines fundamental programming concepts including variables, data types, conditionals, loops, functions, arrays, and object-oriented programming. Each concept is illustrated with examples in various programming languages such as JavaScript, Python, and C#. It serves as a concise guide for understanding basic coding principles.

Uploaded by

Federico Czyrka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

You might also like