title: Swift errors using #if, #endif
body: <p>Using #if, #endif in Swift (using Xcode) produces errors if it cuts into the flow of an operation. This screenshot says it all:</p>
  
  <p><a href="https://i.stack.imgur.com/nX50x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nX50x.png" alt="Swift #if, #endif error"></a></p>
  
  <p>Does anyone know a solution to make this example work, without repeating the entire code block twice? There can easily be situations where the entire block can be very large.</p>
  
  <p>EDIT: My sample was a bit too simple. Here is a new sample where the "else if" depends on the same define (DEBUG). The "else if" must also be within the #if and #endif. And other samples can be much more complex than this.</p>
  
  <p><a href="https://i.stack.imgur.com/wA66K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wA66K.png" alt="enter image description here"></a></p>