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.

Challenge

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

Get hands-on with 1400+ tech skills courses.