Subtract

Updated: 05/02/2021 by Computer Hope

Alternatively called subtraction, subtract is a math operation that takes the value of one number from another number. An example of addition is 10 - 4 = 6. On a computer, you can subtract numbers using a calculator or spreadsheet program and the hyphen (-) or subtraction symbol.

Tip

The computer processor ALU (arithmetic logic unit) performs the subtract operation.

Subtraction operator

In many programming languages, the subtraction operator ( -= ) can be used as a way to add to a previous value. For example, in the Perl code below, the $example variable is first set to a value of "4". The next line uses the subtraction operator to subtract "3" from the variable.

$example = 4;
$example -= 3;
print "Total = $example";

When the script above is executed, the computer would print out "Total = 1" to the screen.

Add, ALU, Arithmetic, Create, Divide, Multiply, Programming terms