in Swift I need to use a variable which I created in a if/else outside of it. I made a little code just for showing the problem
let test = 0
if test == 0 {
let a = "Test is 0"
} else {
let a = "Test is not 0"
}
print(a)
the result is cannot find a in scope
I need the value of the variable outside of the if statement without creating the variable outside first. How I can do that please?