Skip to content

Glossary: Swift Basics

global variable

Also written: global constant, global var

A constant or variable declared outside any function or type. In a package, a global `var` outside `main.swift` is an error, but a global `let` such as `menu` is fine.

Where the book teaches it

Related terms

main.swiftconstantvariable