3.2

Weizmann Institute of Science

Skip to 0 minutes and 0 secondsOperators. 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,

Skip to 0 minutes and 45 secondsThe 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.

Skip to 1 minute and 23 secondsThe binary operator: plus - addition. It acts on two operands. For instance, when the plus operator acts on...

Skip to 1 minute and 33 secondsthe operands: 13 and 26, the answer is 13 + 26, which is 39 Another example pf a binary operation is the word "and".

Skip to 1 minute and 50 secondsOne operand will be the sentence: "It rained today".

Skip to 1 minute and 55 secondsLet'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

Skip to 2 minutes and 8 secondssentence: "It rained today and the dog ate my homework". Let's take a look at an example of a unary operator.

Skip to 2 minutes and 19 secondsWe'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

Skip to 2 minutes and 44 secondsis: 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!

Unary and binary 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.