The basics of Programming
3 min read
Hello 👋 Coders, This is my first blog post so thought why not cover the basics as it will be easy for me to start with and easy for you to understand if you're beginning your coding journey.
So, let's start with one step at a time..
What is Programming?
Programming is the process of giving computer instructions on how to act. Yes, this is it. Wait wait..how can one give instructions to the computer. Do Computers understand us? The answer is no, Computers cannot understand us. They understand only binaries (0 and 1). The instructions that we give them are given through code. This code can be in various programming languages.
Programming language is a language that is used by programmers to communicate with computers. It is a set of instructions written in any specific language like C++, Java, Python, etc.
There are five basic concepts in any Programming Language..
- Conditional Statetments
- Looping & Iteration
- Data types and Data Structures
Consider them boxes, that are used to store data or reference to data. There can be many properties of variables like a name, type, value, scope, lifetime, and location. We'll discuss them in detail in my future posts as this is out of scope for now.
These statements are also known as "if-else" statements, and it is as simple as it sounds. Yeah, you guessed it right. If the given condition satisfies do this or do that (execute else condition).
Iteration & Looping
Let me ask you something. What if you want to print some statement more than 100 times. What will you do? OK OK, I am not considering that your typing speed is 200 wpm. Even if you have, why will you type something again and again if you can do the same in less than 3 lines? Here comes iteration and looping. If the program repeats a sequence or process, that is an iteration. Loops are a type of iteration, where a program carries out action until the new condition is met. In easier words, you will not need to write the same thing again and again.
Data Types & Data Structures
A Data Type is the most basic classification of data. So, basically, it is the type of any variable used in the code. Some of the basic examples are int, double, string, etc.
Data Structures on the other hand are a collection of data types. It is a way of organizing the items in terms of memory, and also the way of accessing each item through some defined logic. Some examples of data structures are stacks, queues, linked lists, binary trees, and many more. I know this might be too much. Don't worry about them now, you do not need to deal with them initially.
A function is a contained block of code that can perform an action. For now, you can remember them as they are the "something" that can be used multiple times in a program and allows users to reuse the same piece of code instead of writing it again and again.
This was it? Write down in comments and let me know if it was helpful.
Did you find this article valuable?
Support Ashutosh Bhadauriya by becoming a sponsor. Any amount is appreciated!