+= operator creating error

Here’s the error I’m getting

Playground execution failed: error: Switch.playground:3:17: error: variable ‘errorString’ passed by reference before being initialized
errorString += " Informational, 1xx."

this doesn’t happen if I’m just using “=” as an operator

any ideas? Has something changed in swift that doesn’t require the addition operator?

That error message is saying the variable errorString must be initialized before being passed by reference to a function.

You probably have something that looks like this:

func giggleAndHoot (_ s: inout String) {
    s += "Giggle & Hoot: ..."
}

var jimmyGiggle : String

giggleAndHoot (&jimmyGiggle)   // Error: jimmyGiggle not initialized!

Intialize the variable first:

var jimmyGiggle : String

jimmyGiggle = ""

giggleAndHoot (&jimmyGiggle)  // Good: jimmyGiggle initialized

Thank you I’ll try that