Skip main navigation

Other modern operators

Dr. Yossi Elran presents a look at some more modern operators.
© Davidson Institute of Science Education, the educational arm of the Weizmann Institute of Science

At this stage you may be wondering if ternary operators (operators that work on three operands) exist? Maybe even more than three?

Indeed, there are operators that operate on more than two operands. They are relatively scarce and are usually defined for specific math operations.

One ternary operator that is used in logic and in computer science is the if-then operator. This operator is denoted by ? (a question mark) and : (a colon) that are written between the three operands like this:
operand a ? operand b : operand c

This operator receives three statements. The first is a condition, the second is an instruction what to do if the condition is true, and the third operand is an instruction what to do if the condition is false.

For example: “It is raining outside” ? “Take an umbrella” : “Don’t take an umbrella”

The meaning of this statement is – check if it is raining outside. If the answer is positive then take an umbrella. If the answer is negative, don’t take an umbrella.

More operators

Many operators are used to perform special functions in spreadsheet programs like Microsoft’s “Excel” or Apple’s “Numbers”. Perhaps you are familiar with the MOD and DIV operators?

The MOD operator calculates the remainder that is left when applying the division operator. For example, 7 MOD 2 = 1 since 7÷2 = 3 with a remainder of 1.

The DIV operator calculates the quotient that is left when applying the division operator. For example, 7 DIV 2 = 3 since 7÷2 = 3. The quotient is 3 and the remainder is 1.

© Davidson Institute of Science Education, the educational arm of the Weizmann Institute of Science
This article is from the free online

Maths Puzzles: Cryptarithms, Symbologies and Secret Codes

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education