New offer! Get 30% off your first 2 months of Unlimited Monthly. Start your subscription for just £35.99 £24.99. New subscribers only T&Cs apply

# Unary and binary operators

Watch this video by Dr. Yossi Elran to learn about binary and unary operators
0
Operators. Operators act on what’s known as operands. An operator can act on one operand, and then it is called a unary operator, or, it can act on two operands and then it is called a binary operator. It can act on more than two operands but we won’t go into this now. The operands can be numbers. They can be words, they can be shapes, in fact… They can be anything at all, for example,
44.5
The mathematical operations: subtraction, addition, multiplication and division can all be operators. But so can the sum of the digits of the number, or, the concatenation, of two numbers or words or phrases, or even taking a shape and giving it half a rotation. That can also be an operator. Let’s see an example of a binary operator.
82.8
The binary operator: plus - addition. It acts on two operands. For instance, when the plus operator acts on…
92.6
the operands: 13 and 26, the answer is 13 + 26, which is 39 Another example pf a binary operation is the word “and”.
109.8
One operand will be the sentence: “It rained today”.
114.8
Let’s take as the other operand the sentence: “The dog ate my homework”. The result of the operator ‘and’ acting on these two sentences is the
128.1
sentence: “It rained today and the dog ate my homework”. Let’s take a look at an example of a unary operator.
139
We’ll use the unary operator: factorial. The factorial operator is symboled by an exclamation mark and it means multiply all the numbers from 1 up to the operand. If we take for instance the operand to be the number 4, then 4 factorial
164
is: 1x2x3x4=24 So, the result of the operator factorial acting on the number 4 is 4 factorial: 1x2x3x4=24. Let’s see the factorial operator again and this time the factorial operator will operate on the number 6. 6 factorial is: 1x2x3x4x5x6=720 which is the result of the operation of the unary operator on the number 6. Operators!

Operators that operate on two operands are known as binary operators. Operators that operate on one operand are known as unary operators. Watch the video to learn about binary and unary operators.