A Pocket Guide To Programming Core

The Operators

If variables are for storing information than operators are for working with that information. You have already seen “Assignment =” operator in previous chapters.

In simple words, operator tells a program about certain action at any point.

Let’s take some real world examples to better understand this.

We name a baby when he/she is born. Basically we are assigning a name.

We don’t go out when temperature is greater than or equal to 40˚ degree or it’s raining very fast. Basically, we are doing a comparison.

We usually go to sleep when it’s night. We are checking equality.

We keep pouring milk in glass until it’s full. We are comparing or checking equality.

What if we need to program a computer to tell us when temperature outside is greater than or equal to 40˚ degree. Or we need to program a robot to help us in the kitchen. It must stop pouring milk when glass is full or almost full.

This is where operators come handy in programming languages. There is operator for almost any real life assignment, comparison, arithmetic and logical action or operation.

Here are few generic operators from different programming languages.

= // Assignment Operator

// Some Comparison operators
== // Equality
!= // Not equal to
>= // Greater and equal to
<= // Less and equal to

// Logical Operators
&& // And condition
|| // Or condition

// Some arithmetic Operators
+ // Addition
- // Subtraction
* // Multiplication
/ // Division
% // Reminder

And there are many more and different operators in different programming languages.

I hope you have an understanding of operators in programming languages that help us program different assignment, comparison, arithmetic and logical operations in our software or application.

Let’s move on to next chapter of this course. Please click on “Next” to continue.

Image placeholder

Hi! I'm Zeeshan Elahi

I have compiled and prepared this content with love for people like me and you. And as you know it always take some time and extra cups of coffee to read, compile and prepare a course or manual. If you have like reading this content and want to say thanks, please consider supporting from more stuff like this.

Leave a comment

Your email address will not be published. Required fields are marked *

*

*