Back to Functions

subtract

math

Subtract two numbers.

Installation

Import
import { subtract } from '@tulx/utils';

Source Code

Implementation
/**
 * Subtract two numbers.
 *
 * @param minuend - The first number in a subtraction.
 * @param subtrahend - The second number in a subtraction.
 * @returns Returns the difference.
 *
 * @example
 * ```ts
 * subtract(6, 4); // 2
 * ```
 */
export function subtract(minuend: number, subtrahend: number): number {
  return minuend - subtrahend;
}

Example

import { subtract } from '@tulx/utils';

subtract(6, 4); // 2

Related Functions