Technology Lesson 2:
Basic Programming Concepts

Introduction to Basic Programming Concepts

In this lesson, we'll learn about four fundamental programming concepts: variables, conditionals, loops, and functions. These concepts form the building blocks of most programming languages.

Variables

Variables are used to store data in a program. They can hold different types of data, such as numbers, text, or boolean values (true/false).

Exercise: Variables

Declare a variable and assign it a value:

Conditionals

Conditionals allow programs to make decisions based on certain conditions. The most common form is the if-else statement.

Exercise: Conditionals

Check if a number is positive or negative:

Loops

Loops allow you to repeat a block of code multiple times. Common types include for loops and while loops.

Exercise: Loops

Print numbers from 1 to N:

Functions

Functions are reusable blocks of code that perform specific tasks. They help in organizing and modularizing code.

Exercise: Functions

Create a function to calculate the area of a rectangle:

AI Interaction