Swift - Operator Division Operator

Introduction

The division operator / divides a number by another number.

Dividing an integer by another integer will return only the integer part of the result:

print(5 / 6)       //integer division (0)
print(6 / 5)       //integer division (1)

Dividing a double by an integer will return a double:

print(6.1 / 5)     //double division (1.22)
print(9.99 / 5)    //double division (1.998)

Dividing a double by a double will return a double:

print(6.1 / 5.5)   //double division (1.10909090909091)

Related Topic