Saturday, May 25, 2024 06:04

Posts Tagged ‘operators’

Concatenator operator

Friday, January 6th, 2017

Though 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

Logical operators

Friday, January 6th, 2017

Logical operators are quite simple, since they can only produce two outputs: true or false. The basic logical (Boolean) operators are AND (&&), OR (||),  XOR (also called “Exclusive OR”, ^) and NOT (or negation, !).

I will show you a sample of the four logical operations and the results that they produce:

Read more

Decrementing operator

Friday, January 6th, 2017

Decrementing operator is the complementary part of the incrementing operator. What applies to the incrementing operator, also applies for the decrementing one.

Obviously, the difference is in the syntax and behavior. Decrementing operator can be expressed in four ways, just like incrementing one:

The difference in behavior should be obvious and self-explanatory: instead of adding, we subtract.… Read more

Incrementing operator

Thursday, January 5th, 2017

One of the most used operations in programming is incrementing a variable’s value. Incrementing operator is composed of two plus signs: ++ (and has two forms), or a variation of the following two operators: += and =+.

Lets consider the following example:

In the above example, we are assigning a variable the result of adding 1 to its own value.… Read more

Arithmetical operators

Thursday, January 5th, 2017

Basically, arithmetical operators (+, -, *, /) are the same as the mathematical ones. However, there are a few things to point out.

The most important thing to watch out is the kind of result you are expecting. If you will use two integers to perform a division, do not expect to get a real number, do not expect to get rounding, or any fractional part.… Read more

Operator precedence

Thursday, January 5th, 2017

If you still remember from math class (yeah, right! 😀 ), some operators have precedence over others, meaning that multiplication is more important than addition and will be calculated first. Operator precedence should always be remembered when dealing with more than two operands.… Read more


Wednesday, January 4th, 2017

No, we’re not talking about the landline phone operators 🙂 . As you can imagine, storing data in variables is pointless if we are not manipulating and/or using that data. Even in the most simple programs, you will use mathematical operations like subtraction, addition, multiplication, division.… Read more

Follow the white rabbit