Null strings and let declaration order

are there restrictions in elements for when in a scope let declarations should work?

let a = "a"
print(a)

let b= "b"
print(a)
print(b)

----output----
a
a
(null)
let a = "a"
let b= "b"

print(a)

print(a)
print(b)

--- output ---
a
a
b

this is different than in xcode. also using ‘var’ vs let gets the expected output

this sounds like a bug. What platform?

Logged as bugs://E25734.

Reproduced on .NET. thanx! It looks like let does not initialize the var, if its preceded by any other statements, in main(). Definitely a bug.

perfect – thanks

1 Like

bugs://E25734 was closed as fixed.