Skip to content

Global Scope

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Global Scope

The global scope is an invisible scope that persists for the entire duration of the program

The primary case where the global scope plays a role, is where global variables need cleaning up before the program exits:

import basics

func main {
    
}

struct Bomb () {
    func __defer__ {
        print("Kaboom!")
    }
}

bomb Bomb
Kaboom!
Clone this wiki locally