I've noticed that Playgrounds in Xcode 10 no longer allow for the use of declared, but uninitialized variables. For example:
while this code would work in an Xcode 9 playground, in an Xcode 10 playground (at least in Beta 1), it crashes:
var myValue: Int
//...
myValue = 100
print (myValue)
// Xcode 9 prints 100
// Xcode 10 reports an error: variables currently must have an initial value when entered at the top level of the REPL
Is this the new behavior, or just a bug in the current Xcode 10 beta?
I had been referring to earlier Xcode Playgrounds as an interpreter, but would one still consider Xcode 10 playgrounds to be an interpreter (and was that always correct)? Apple refers to the "Run" button in the gutter as "compiling" code.
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…