Operators are special symbols that perform operations on variables and values. In C#, operators are categorized by their purpose. This tutorial covers all main operators with examples and interactive demos.
Used for basic math operations.
+
Addition-
Subtraction*
Multiplication/
Division%
Modulus (Remainder)Used to assign values.
=
Assign+=
Add and assign-=
Subtract and assign*=
Multiply and assign/=
Divide and assign%=
Modulus and assignCompare two values, returning a boolean (true
or false
).
==
Equal to!=
Not equal to>
Greater than<
Less than>=
Greater than or equal to<=
Less than or equal toUsed to combine or invert boolean expressions.
&&
Logical AND||
Logical OR!
Logical NOTIncrease or decrease a value by 1.
++
Increment by 1--
Decrement by 1
Change the values of a
and b
, then click Run to see how each operator works.
Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!