Global Variables

// excerpted from Swift Tutorials
var landmarks: [Landmark] = load("landmarkData.json")

// excerpted from ๅฝผๅพ—ๆฝ˜
var grade = 0
  • ไปปไฝ•ๆช”ๆกˆ็š†ๅฏๅญ˜ๅ– global variableใ€‚

  • global variable ๅฏซๅœจๅ“ชๅ€‹ๆช”ๆกˆ้ƒฝๅฏไปฅใ€‚

  • Global constants and variables are always computed lazily.

    ๐Ÿ‘‰ Lazy Stored Properties

  • Global variables are defined outside of any function, method, closure, or type context.

Last updated