Skip to content

@libs.arithmetic.Addition.Adder

github-actions[bot] edited this page Jan 24, 2024 · 7 revisions

Class: Adder

@libs/arithmetic.Addition.Adder

Adds two number with a class.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Adder(x): Adder

Creates an instance of Adder.

Parameters

Name Type Description
x number The first number.

Returns

Adder

Defined in

add.ts:30

Properties

x

Readonly x: number

The first number.

Defined in

add.ts:30

Methods

add

add(y): number

Adds the number to the instance number.

Parameters

Name Type Description
y number The second number.

Returns

number

The sum of the two numbers.

Example

// Return 2:
new Adder(1).add(1);

Defined in

add.ts:42