Swift - Operator Multiplication Operator

Introduction

The multiplication operator * multiplies two numbers.

Multiplying numbers of different types yields results of different types.

Multiplying two integer numbers results in an integer result:

print(3 * 4)       //integer multiplication (12)

Multiplying a double value with an integer value also results in a double result:

print(3.1 * 4)     //double multiplication (12.4)

When you multiply two double values you get a double result:

print(3.1 * 4.0)   //double multiplication (12.4)

Related Topic