Fortran

Guide To Learn

An operator is a special creature in most programming languages. All expressions are made of some combination of literal constants, variables, function calls, and, you guessed it, operators. Like in math, operators are used to combine values (numeric or otherwise), to compute a new value. In fact, we’ve been working with operators since chapter 2 without giving them any special mention. Now we’ll start paying more attention to them because we’ll want to tweak them for special capabilities.

Operators can be unary or binary, depending on whether they take one or two operands, respectively. Take, for example, the arithmetic multiplication operator *. This is a binary operator because it’s only meaningful to apply it to two numbers; for example, 3 * 5. Unary operators apply to a single operand. For example, the subtraction operator can be unary (-5) or binary (3 - 5).

What’s an operator?

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top