6 Basic Coding Concepts for Begineers
Pradhuman Shrestha
12/13/2023Currently, there are hundreds of programming languages in use(like C, C++, C#, Java, JavaScript, Ruby, Python, etc). But all they share the same foundational building blocks. Here, I am going to write about six basic concepts that help me to learn a different programming language(In my case PHP, Javascript).
-
Variables
Variables are like containers where we can store the data. There may be different ways of creating and declaring the variables for the different languages but, the core concept is the same for every programming language. <br>For example :-
- String txt = "hello world" (Java)
- $txt = "hello world" (PHP),
- var txt = "hello world" (JavaScript),
- txt = "hello world" (Python)
-
Data-Types
A classification for data that tells us what type of value that variable can store. <br>For example (int a) here a is the variable name where we can hold value and int is the data type that variable can hold. So, int a can hold or store integer data types only.
Here is some common data-types list.
- String
- Integer
- Float (For decimal numbers)
- Boolean
- Array
- Object
- Null
-
Operator
An operator is a symbol that is used to perform operations on variables and values. <br> For example (int a = 5 + 5), here int is a data type, a is the variable that holds the value, and "+" is the operator that is used to operate the addition of two values.
Here is a common operator list.
- "+" (addition)
- "-" (subtraction)
- "/" (division)
- "*" (multiplication)
- "=" (assigning values to variables)
- "==" (Equal)
- "===" (identical)
- "!=" (Not Equal)
- "<>" (Not Equal)
- ">" (Greater Than)
- "<" (Less than)
-
Conditional Statements
Every language uses conditional statements for performing the action as per the condition.<br> Here are some common statements listed.
- if statements (excutes the code if one condition is true)
- if...esle statements (excute the two action with two condition (true or false).)
- if...elseif...else statements (executes different actions with many conditions).
- switch statements (execute action with particular condidtion)
-
Loops
Loops are used to run the code several times, as long as a certain condition is true. <br> Here are some Loops lists.
- while loops (run the code as long as the specific condition is true).
- do...while loops ( run the code once and then repeats the loop as long as the condition is true)
- for loops (run the code specific number of times)
- foreach loops (run the code for each element in an array)
-
functions
This block of code is designed to perform a particular task. The application can have different functions to perform different tasks.
Hope this explanation helps you to understand the basics of programming. Please share this post with others if you like.