Swift - Write program to fix a compiler error in string interpolation

Requirements

The following statements resulted in a compiler error. Fix it.


var weight = 102.5      // in pounds
var str = "Your weight is " + weight + " pounds"

Hint

Use \(variable)

Demo

var weight = 102.5      // in pounds
var str = "Your weight is \(weight) pounds"

Related Exercise