Avatar
ちょうど最近トップレベルの変数宣言についてアクティブな議論がありました。 https://forums.swift.org/t/on-the-behavior-of-variables-in-top-level-code/52230
The variables in top-level code behave weirdly. They are declared in the global scope, but are initialized serially, like local variables in a normal function. This allows some interesting pieces of code to compile, such as: print(x) var x = 32 This program will print 0. The basic value types are automatically initialized, so they have a value...
👀 1