Open the App

Subjects

Computer Science

26 Nov 2025

252

6 pages

Introduction to Programming Basics

T

Tara Vidal @taravidal_jrny

Programming might seem complex, but it's actually built on just three simple building blocks that control how computers... Show more

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Programming Constructs and Control Flow

Every program you've ever used follows the same three basic patterns. Sequence simply means instructions happen in order, one after another. Selection lets programs make decisions using if-then statements. Iteration allows code to repeat itself, which is incredibly powerful.

Selection works by testing conditions that give true or false results. You write this as "if conditioncondition then dosomethingdo something end if". It's like teaching your program to make simple yes/no decisions.

Iteration comes in two flavours. Count-controlled iteration repeats code a specific number of times—perfect when you know exactly how many loops you need. Condition-controlled iteration keeps going until something changes, which is brilliant for unknown situations.

Quick Tip Iteration saves you from writing the same code hundreds of times. Instead of typing "print hello" fifty times, you write it once in a loop!

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Types of Loops and Advanced Techniques

While loops check a condition first, then run the code if it's true. They keep checking and running until the condition becomes false. Repeat loops work backwards—they run the code first, then check if they should continue.

Infinite loops can be your best friend or worst nightmare. Sometimes you want them (like in games that run continuously), but accidental infinite loops will crash your program.

Nesting means putting programming constructs inside each other—like loops within loops or if statements inside other if statements. This reduces code length and makes debugging much easier since everything's organised logically.

Remember Nested structures help you solve complex problems by breaking them into smaller, manageable pieces.

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Variables and Data Types

Variables are like labelled boxes in your computer's memory that can hold different values. Think of them as containers that can change their contents whilst your program runs. Constants are the opposite—they never change once you set them.

Your variable names (called identifiers) must start with a letter and can't contain spaces or special characters. Keep them simple and descriptive so you remember what they're for.

Computers recognise different data types integers for whole numbers, floats for decimals, characters for single letters, strings for words, and booleans for true/false values. Casting lets you convert between these types when needed.

String manipulation is incredibly useful. You can find a string's length with 'len', grab specific characters using positions (remember, computers start counting at 0!), change case with upper/lower commands, and join strings together through concatenation.

Pro Tip String positions can be confusing at first, but remember that computers always start counting from 0, not 1!

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Arrays and Operators

Arrays are like organised lists that store multiple values of the same type. They're perfect when you need to manage lots of related data, like a class full of test scores or a shopping list.

When declaring an array, you need an identifier (name) and size (how many items it'll hold). Remember that an array with 10 elements is numbered 0-9, not 1-10. You can even create two-dimensional arrays that work like spreadsheets with rows and columns.

Operators fall into three categories. Mathematical operators handle basic maths (+, -, *, /), plus special ones like DIV for integer division and MOD for remainders. Comparison operators test relationships between values (=, <, >, <=, >=). Logical operators combine conditions using AND, OR, and NOT.

Quick Check 20 DIV 3 = 6 (whole number division) and 20 MOD 3 = 2 (the remainder). These are super handy for many programming tasks!

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Files and Data Management

Files are simply anything you save—documents, music, data collections. Your programs can interact with files in two ways read from them to get information, or write to them to save information.

Always remember to open files before using them (either for reading or writing) and close them afterwards. Think of it like opening and closing a book—you need to open it to read, then close it when you're done.

Records collect related attributes (bits of data) together. For example, a student record might include name, age, and grade as separate attributes. SQL (Structured Query Language) helps you work with databases using commands like SELECT, FROM, and WHERE.

File Tip Arrays work brilliantly for storing data you've read from files, making it easy to process and manipulate information.

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Subprograms and Built-in Functions

Subprograms are small programs within your main program that handle specific tasks. They come in two types procedures do one job then finish, whilst functions manipulate data and send results back to your main program.

Using subprograms makes your code shorter, easier to debug, and reusable. Write once, use many times! You can save them separately and recycle them in different projects.

Your programming language comes with helpful built-in functions ready to use. Functions like int() convert strings to integers, str() converts numbers to text, and asc() finds ASCII codes for characters. These save you time and effort.

Smart Move Break complex problems into smaller subprograms. It's like having a toolbox where each tool has one specific job—much more organised and efficient!

We thought you’d never ask...

What is the Knowunity AI companion?

Our AI Companion is a student-focused AI tool that offers more than just answers. Built on millions of Knowunity resources, it provides relevant information, personalised study plans, quizzes, and content directly in the chat, adapting to your individual learning journey.

Where can I download the Knowunity app?

You can download the app from Google Play Store and Apple App Store.

Is Knowunity really free of charge?

That's right! Enjoy free access to study content, connect with fellow students, and get instant help – all at your fingertips.

7

Smart Tools NEW

Transform this note into: ✓ 50+ Practice Questions ✓ Interactive Flashcards ✓ Full Mock Exam ✓ Essay Outlines

Mock Exam
Quiz
Flashcards
Essay

Can't find what you're looking for? Explore other subjects.

Students love us — and so will you.

4.9/5

App Store

4.8/5

Google Play

The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.

Stefan S

iOS user

This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.

Samantha Klich

Android user

Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.

Anna

iOS user

Best app on earth! no words because it’s too good

Thomas R

iOS user

Just amazing. Let's me revise 10x better, this app is a quick 10/10. I highly recommend it to anyone. I can watch and search for notes. I can save them in the subject folder. I can revise it any time when I come back. If you haven't tried this app, you're really missing out.

Basil

Android user

This app has made me feel so much more confident in my exam prep, not only through boosting my own self confidence through the features that allow you to connect with others and feel less alone, but also through the way the app itself is centred around making you feel better. It is easy to navigate, fun to use, and helpful to anyone struggling in absolutely any way.

David K

iOS user

The app's just great! All I have to do is enter the topic in the search bar and I get the response real fast. I don't have to watch 10 YouTube videos to understand something, so I'm saving my time. Highly recommended!

Sudenaz Ocak

Android user

In school I was really bad at maths but thanks to the app, I am doing better now. I am so grateful that you made the app.

Greenlight Bonnie

Android user

very reliable app to help and grow your ideas of Maths, English and other related topics in your works. please use this app if your struggling in areas, this app is key for that. wish I'd of done a review before. and it's also free so don't worry about that.

Rohan U

Android user

I know a lot of apps use fake accounts to boost their reviews but this app deserves it all. Originally I was getting 4 in my English exams and this time I got a grade 7. I didn’t even know about this app three days until the exam and it has helped A LOT. Please actually trust me and use it as I’m sure you too will see developments.

Xander S

iOS user

THE QUIZES AND FLASHCARDS ARE SO USEFUL AND I LOVE THE SCHOOLGPT. IT ALSO IS LITREALLY LIKE CHATGPT BUT SMARTER!! HELPED ME WITH MY MASCARA PROBLEMS TOO!! AS WELL AS MY REAL SUBJECTS ! DUHHH 😍😁😲🤑💗✨🎀😮

Elisha

iOS user

This apps acc the goat. I find revision so boring but this app makes it so easy to organize it all and then you can ask the freeeee ai to test yourself so good and you can easily upload your own stuff. highly recommend as someone taking mocks now

Paul T

iOS user

The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.

Stefan S

iOS user

This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.

Samantha Klich

Android user

Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.

Anna

iOS user

Best app on earth! no words because it’s too good

Thomas R

iOS user

Just amazing. Let's me revise 10x better, this app is a quick 10/10. I highly recommend it to anyone. I can watch and search for notes. I can save them in the subject folder. I can revise it any time when I come back. If you haven't tried this app, you're really missing out.

Basil

Android user

This app has made me feel so much more confident in my exam prep, not only through boosting my own self confidence through the features that allow you to connect with others and feel less alone, but also through the way the app itself is centred around making you feel better. It is easy to navigate, fun to use, and helpful to anyone struggling in absolutely any way.

David K

iOS user

The app's just great! All I have to do is enter the topic in the search bar and I get the response real fast. I don't have to watch 10 YouTube videos to understand something, so I'm saving my time. Highly recommended!

Sudenaz Ocak

Android user

In school I was really bad at maths but thanks to the app, I am doing better now. I am so grateful that you made the app.

Greenlight Bonnie

Android user

very reliable app to help and grow your ideas of Maths, English and other related topics in your works. please use this app if your struggling in areas, this app is key for that. wish I'd of done a review before. and it's also free so don't worry about that.

Rohan U

Android user

I know a lot of apps use fake accounts to boost their reviews but this app deserves it all. Originally I was getting 4 in my English exams and this time I got a grade 7. I didn’t even know about this app three days until the exam and it has helped A LOT. Please actually trust me and use it as I’m sure you too will see developments.

Xander S

iOS user

THE QUIZES AND FLASHCARDS ARE SO USEFUL AND I LOVE THE SCHOOLGPT. IT ALSO IS LITREALLY LIKE CHATGPT BUT SMARTER!! HELPED ME WITH MY MASCARA PROBLEMS TOO!! AS WELL AS MY REAL SUBJECTS ! DUHHH 😍😁😲🤑💗✨🎀😮

Elisha

iOS user

This apps acc the goat. I find revision so boring but this app makes it so easy to organize it all and then you can ask the freeeee ai to test yourself so good and you can easily upload your own stuff. highly recommend as someone taking mocks now

Paul T

iOS user

 

Computer Science

252

26 Nov 2025

6 pages

Introduction to Programming Basics

T

Tara Vidal

@taravidal_jrny

Programming might seem complex, but it's actually built on just three simple building blocks that control how computers follow instructions. Understanding these basic constructs—along with how to store and manipulate data—gives you the foundation to create any program you can... Show more

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Sign up to see the contentIt's free!

Access to all documents

Improve your grades

Join milions of students

By signing up you accept Terms of Service and Privacy Policy

Programming Constructs and Control Flow

Every program you've ever used follows the same three basic patterns. Sequence simply means instructions happen in order, one after another. Selection lets programs make decisions using if-then statements. Iteration allows code to repeat itself, which is incredibly powerful.

Selection works by testing conditions that give true or false results. You write this as "if conditioncondition then dosomethingdo something end if". It's like teaching your program to make simple yes/no decisions.

Iteration comes in two flavours. Count-controlled iteration repeats code a specific number of times—perfect when you know exactly how many loops you need. Condition-controlled iteration keeps going until something changes, which is brilliant for unknown situations.

Quick Tip: Iteration saves you from writing the same code hundreds of times. Instead of typing "print hello" fifty times, you write it once in a loop!

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Sign up to see the contentIt's free!

Access to all documents

Improve your grades

Join milions of students

By signing up you accept Terms of Service and Privacy Policy

Types of Loops and Advanced Techniques

While loops check a condition first, then run the code if it's true. They keep checking and running until the condition becomes false. Repeat loops work backwards—they run the code first, then check if they should continue.

Infinite loops can be your best friend or worst nightmare. Sometimes you want them (like in games that run continuously), but accidental infinite loops will crash your program.

Nesting means putting programming constructs inside each other—like loops within loops or if statements inside other if statements. This reduces code length and makes debugging much easier since everything's organised logically.

Remember: Nested structures help you solve complex problems by breaking them into smaller, manageable pieces.

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Sign up to see the contentIt's free!

Access to all documents

Improve your grades

Join milions of students

By signing up you accept Terms of Service and Privacy Policy

Variables and Data Types

Variables are like labelled boxes in your computer's memory that can hold different values. Think of them as containers that can change their contents whilst your program runs. Constants are the opposite—they never change once you set them.

Your variable names (called identifiers) must start with a letter and can't contain spaces or special characters. Keep them simple and descriptive so you remember what they're for.

Computers recognise different data types: integers for whole numbers, floats for decimals, characters for single letters, strings for words, and booleans for true/false values. Casting lets you convert between these types when needed.

String manipulation is incredibly useful. You can find a string's length with 'len', grab specific characters using positions (remember, computers start counting at 0!), change case with upper/lower commands, and join strings together through concatenation.

Pro Tip: String positions can be confusing at first, but remember that computers always start counting from 0, not 1!

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Sign up to see the contentIt's free!

Access to all documents

Improve your grades

Join milions of students

By signing up you accept Terms of Service and Privacy Policy

Arrays and Operators

Arrays are like organised lists that store multiple values of the same type. They're perfect when you need to manage lots of related data, like a class full of test scores or a shopping list.

When declaring an array, you need an identifier (name) and size (how many items it'll hold). Remember that an array with 10 elements is numbered 0-9, not 1-10. You can even create two-dimensional arrays that work like spreadsheets with rows and columns.

Operators fall into three categories. Mathematical operators handle basic maths (+, -, *, /), plus special ones like DIV for integer division and MOD for remainders. Comparison operators test relationships between values (=, <, >, <=, >=). Logical operators combine conditions using AND, OR, and NOT.

Quick Check: 20 DIV 3 = 6 (whole number division) and 20 MOD 3 = 2 (the remainder). These are super handy for many programming tasks!

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Sign up to see the contentIt's free!

Access to all documents

Improve your grades

Join milions of students

By signing up you accept Terms of Service and Privacy Policy

Files and Data Management

Files are simply anything you save—documents, music, data collections. Your programs can interact with files in two ways: read from them to get information, or write to them to save information.

Always remember to open files before using them (either for reading or writing) and close them afterwards. Think of it like opening and closing a book—you need to open it to read, then close it when you're done.

Records collect related attributes (bits of data) together. For example, a student record might include name, age, and grade as separate attributes. SQL (Structured Query Language) helps you work with databases using commands like SELECT, FROM, and WHERE.

File Tip: Arrays work brilliantly for storing data you've read from files, making it easy to process and manipulate information.

1. 3 basic program- sequence
ming constructs selection
 iteration
2. Sequence the order in which the instructions occur and are
 processed
3

Sign up to see the contentIt's free!

Access to all documents

Improve your grades

Join milions of students

By signing up you accept Terms of Service and Privacy Policy

Subprograms and Built-in Functions

Subprograms are small programs within your main program that handle specific tasks. They come in two types: procedures do one job then finish, whilst functions manipulate data and send results back to your main program.

Using subprograms makes your code shorter, easier to debug, and reusable. Write once, use many times! You can save them separately and recycle them in different projects.

Your programming language comes with helpful built-in functions ready to use. Functions like int() convert strings to integers, str() converts numbers to text, and asc() finds ASCII codes for characters. These save you time and effort.

Smart Move: Break complex problems into smaller subprograms. It's like having a toolbox where each tool has one specific job—much more organised and efficient!

We thought you’d never ask...

What is the Knowunity AI companion?

Our AI Companion is a student-focused AI tool that offers more than just answers. Built on millions of Knowunity resources, it provides relevant information, personalised study plans, quizzes, and content directly in the chat, adapting to your individual learning journey.

Where can I download the Knowunity app?

You can download the app from Google Play Store and Apple App Store.

Is Knowunity really free of charge?

That's right! Enjoy free access to study content, connect with fellow students, and get instant help – all at your fingertips.

7

Smart Tools NEW

Transform this note into: ✓ 50+ Practice Questions ✓ Interactive Flashcards ✓ Full Mock Exam ✓ Essay Outlines

Mock Exam
Quiz
Flashcards
Essay

Can't find what you're looking for? Explore other subjects.

Students love us — and so will you.

4.9/5

App Store

4.8/5

Google Play

The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.

Stefan S

iOS user

This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.

Samantha Klich

Android user

Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.

Anna

iOS user

Best app on earth! no words because it’s too good

Thomas R

iOS user

Just amazing. Let's me revise 10x better, this app is a quick 10/10. I highly recommend it to anyone. I can watch and search for notes. I can save them in the subject folder. I can revise it any time when I come back. If you haven't tried this app, you're really missing out.

Basil

Android user

This app has made me feel so much more confident in my exam prep, not only through boosting my own self confidence through the features that allow you to connect with others and feel less alone, but also through the way the app itself is centred around making you feel better. It is easy to navigate, fun to use, and helpful to anyone struggling in absolutely any way.

David K

iOS user

The app's just great! All I have to do is enter the topic in the search bar and I get the response real fast. I don't have to watch 10 YouTube videos to understand something, so I'm saving my time. Highly recommended!

Sudenaz Ocak

Android user

In school I was really bad at maths but thanks to the app, I am doing better now. I am so grateful that you made the app.

Greenlight Bonnie

Android user

very reliable app to help and grow your ideas of Maths, English and other related topics in your works. please use this app if your struggling in areas, this app is key for that. wish I'd of done a review before. and it's also free so don't worry about that.

Rohan U

Android user

I know a lot of apps use fake accounts to boost their reviews but this app deserves it all. Originally I was getting 4 in my English exams and this time I got a grade 7. I didn’t even know about this app three days until the exam and it has helped A LOT. Please actually trust me and use it as I’m sure you too will see developments.

Xander S

iOS user

THE QUIZES AND FLASHCARDS ARE SO USEFUL AND I LOVE THE SCHOOLGPT. IT ALSO IS LITREALLY LIKE CHATGPT BUT SMARTER!! HELPED ME WITH MY MASCARA PROBLEMS TOO!! AS WELL AS MY REAL SUBJECTS ! DUHHH 😍😁😲🤑💗✨🎀😮

Elisha

iOS user

This apps acc the goat. I find revision so boring but this app makes it so easy to organize it all and then you can ask the freeeee ai to test yourself so good and you can easily upload your own stuff. highly recommend as someone taking mocks now

Paul T

iOS user

The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.

Stefan S

iOS user

This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.

Samantha Klich

Android user

Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.

Anna

iOS user

Best app on earth! no words because it’s too good

Thomas R

iOS user

Just amazing. Let's me revise 10x better, this app is a quick 10/10. I highly recommend it to anyone. I can watch and search for notes. I can save them in the subject folder. I can revise it any time when I come back. If you haven't tried this app, you're really missing out.

Basil

Android user

This app has made me feel so much more confident in my exam prep, not only through boosting my own self confidence through the features that allow you to connect with others and feel less alone, but also through the way the app itself is centred around making you feel better. It is easy to navigate, fun to use, and helpful to anyone struggling in absolutely any way.

David K

iOS user

The app's just great! All I have to do is enter the topic in the search bar and I get the response real fast. I don't have to watch 10 YouTube videos to understand something, so I'm saving my time. Highly recommended!

Sudenaz Ocak

Android user

In school I was really bad at maths but thanks to the app, I am doing better now. I am so grateful that you made the app.

Greenlight Bonnie

Android user

very reliable app to help and grow your ideas of Maths, English and other related topics in your works. please use this app if your struggling in areas, this app is key for that. wish I'd of done a review before. and it's also free so don't worry about that.

Rohan U

Android user

I know a lot of apps use fake accounts to boost their reviews but this app deserves it all. Originally I was getting 4 in my English exams and this time I got a grade 7. I didn’t even know about this app three days until the exam and it has helped A LOT. Please actually trust me and use it as I’m sure you too will see developments.

Xander S

iOS user

THE QUIZES AND FLASHCARDS ARE SO USEFUL AND I LOVE THE SCHOOLGPT. IT ALSO IS LITREALLY LIKE CHATGPT BUT SMARTER!! HELPED ME WITH MY MASCARA PROBLEMS TOO!! AS WELL AS MY REAL SUBJECTS ! DUHHH 😍😁😲🤑💗✨🎀😮

Elisha

iOS user

This apps acc the goat. I find revision so boring but this app makes it so easy to organize it all and then you can ask the freeeee ai to test yourself so good and you can easily upload your own stuff. highly recommend as someone taking mocks now

Paul T

iOS user