Error when using + = to add character to string: String is not identical to UInt8
When trying to use the operator +=
to add Character
to String
, I get the following error:
String is not identical to UInt8
The error is in the line puzzleOutput += char
in the code below:
let puzzleInput = "great minds think alike "
var puzzleOutput = ""
for char in puzzleInput
{
switch char
{
case "a","e","i","o","u":
continue
default:
puzzleOutput += char
}
}
println(puzzleOutput)
How to add Charater
to String
?
+3
source to share