Home » F# Binary Airthmetic Operators

F# Binary Airthmetic Operators

by Online Tutorials Library

F# Binary Arithmetic operators

Symbol Description
+(addition, plus) It adds two values
-(subtract, minus) It subtracts two values
*(multiplication, times) It multiplies two values
/(division, divided by) It is used to divide
%(modulus, mod) It returns remainder of division operation
**(exponentiation, to the power of) It performs exponent operation

F# Arithmetic Operator Example

Output:

--------------------Result------------------ sum = 20 subtraction = 30 multiply = 100 division = 5 modulus = 1 

F# Unary Arithmetic Operators

Symbol Description
+(positive) It applies on arithmetic expressions. It does not change sign of value
-(negative,negation) It applies on arithmetic expressions. It changes sign of value.

F# Binary Comparison Operators

Symbol Description
=(equality, equals) This is not an assignment operator. It is used only for comparison. This is a generic operator.
>(greater than) It is a generic operator
<(less then) It is a generic operator
>=(greater than or equals) It is a generic operator
<=(less than or equals) It is a generic operator
<>(not equal) It is a generic operator

F# Comparison Operator Example

Output:

A is less than B 

You may also like