Good morning, Swift community!
I’ve come across a situation a number of times where I write code that has to try something one or more times using a `repeat…while` loop and the condition relies upon variables that should be declared within the scope of the loop.
let success = doSomething()
The compiler unnecessarily prohibits this: “Use of unresolved identifier four.” In this simple case, we can write:
But in a more complex situation, we are forced to write:
var success: Bool
success = doSomething()
We could change this so that the declarations within the top level scope of the loop are accessible from the condition.
Thanks for reading my first post to the Swift discussion board!