Exercise: Detect Narrowing Conversion

Detect a narrowing conversion with designated initializers.

We'll cover the following

Designated initializers detect narrowing conversions. Narrowing conversion results in the loss of precision.


Extend the following program so that narrowing conversion takes place. Which error message do you get?

Get hands-on with 1200+ tech skills courses.