title: Can you write a forEach() closure within a string .append() in Swift 5? Getting error, so far
body: <p>I am new to Swift and I am trying to experiment with the language to familiarize myself with all the cool functionality. Currently, I am trying to write a <code>forEach</code> closure to append a different string depending on the value of the element in the <code>forEach</code>. The variable <code>lightStates</code> is a <code>[Bool]</code> list. What I am looking for is for <code>statusStr</code> to be a string of <code>"1"</code>'s and <code>"0"</code>'s  depending if the <code>b</code> element in the <code>forEach</code> closure is true or false,</p>
  
  <p>I am getting a <code>"Declared closure result 'String' is incompatible with contextual type 'Void'"</code> error at the <code>String in</code>... line within the closure.</p>
  
  <pre><code>   var statusStr : String = ""
     statusStr.append(lightStates.forEach{ (b:Bool) -&gt; String in return b ? "1":"0"})
     return "Lights: \(statusStr) \n"
  </code></pre>
  
  <p>Ideally, I would like to know know if what I am doing is even allow/possible. But also I am open to suggestions in how to get the desired functionality (printing a string of <code>"1"</code>'s and <code>"0"</code>'s  based on a array of <code>[Bool]</code>s)</p>