Arithmetic operators

Arithmetic operators supported by the F# language are outlined in the following table. Assuming variable X = 10 and variable Y = 40 , we have the following expressions:

Operator

Description

Example

+

Adds two values

X + Y  = 50

-

Subtracts the second value from the first

X - Y = -30

*

Multiplies both values

X * Y = 400

/

Divides two values

Y / X = 4

%

Modulus operator and gives the value of the remainder after an integer division

Y % X = 0

**

Exponentiation operator; raises one variable to the power of another

Y**X = 4010

Get .NET Core 2.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.