I have explained a few times already that when we are dealing with objects, most of the times we are not working with the original class itself – the blueprint, but we are actually create copies of it called instances.… Read more
Posts Tagged ‘operators’
Instantiation
Wednesday, April 26th, 2017Return operator
Tuesday, April 18th, 2017In few of our previous lessons, we used functions – methods that not only can be called, perform some action, but also return a value to the caller – the piece of code that called them. You can imagine this as placing the returned value in the place where the function was invoked from.… Read more
Continue operator
Monday, January 16th, 2017In the last article, we spoke about the Break operator being used to immediately stop a loop and continue the execution with the statements that follow after the loop. The Continue operator works somehow in the same way, with the only difference that it will only make the execution skip the current iteration of the loop.… Read more
Break operator
Monday, January 16th, 2017The break operator is used whenever we want to end a loop immediately, even before ending its execution in a natural way. Whenever the Break operator is met, the execution of the loop is immediately stopped and the program continues executing the first instruction that follows after the loop.… Read more
Other operators
Friday, January 6th, 2017Aside of the operators I have enumerated so far, there are a few other operators that are either too simple, too rarely used or too unimportant to create additional posts for them.
The . (dot) operator. We’ve used it quite a lot so far (remember Console.WriteLine?).… Read more
Conditional operator
Friday, January 6th, 2017Conditional operator is a bit harder to explain. It takes an expression which produces a Boolean result in order to determine which of two other expressions will be calculated and have its value returned as a result. Its sign is ?:.… Read more
Assignment operators
Friday, January 6th, 2017This is the simplest operator of them all. It’s expressed simply by the equal (=) sign. Assignment operators are used to assign (give) a value to a variable.
They can also be used in cascade. Lets have a look at simple and cascaded assignment:
1 2 3 |
string name = "John Doe"; int x, y, z; x = y = z = 3; |
One very important thing to always remember is NOT to confuse the assignment operator = with the comparison operator == (a very common programming mistake).… Read more
Comparison operators
Friday, January 6th, 2017Another kind of operators we have enumerated are the comparison operators. As their name suggest, comparison operators are used to compare operands. There are 6 comparison operators:
1 2 3 4 5 6 |
> greater than < less than >= greater than or equal to <= less than or equal to == equality != difference |
All of the above operators return a Boolean value (true or false).… Read more
Bitwise operators
Friday, January 6th, 2017Any programmer knows that computers can only process information represented by a series of binary numbers (1 and 0). This means that when we store the number 55 in memory of the computer, it actually stores a series of bits represented as 00110111.… Read more
Concatenator operator
Friday, January 6th, 2017Though we already used the concatenator operator quite a few times, we did not explain it yet. The concatenator operator (+) is used to join values of type string together.
As a side note, it is not necessary for both operands to be of type string.… Read more