Skip to content

Statement Scope

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Statement Scope

Statement scope is an invisible scope that surrounds every statement

The primary way that statement scope impacts the program, is by ensuring that dropped temporary values are properly cleaned up.

import basics

func main {
    // We are ignoring the returned String, which requires deconstruction
    // This destruction is taken care of by the invisible statement scope
    getName()
}

func getName() String {
    return "Isaac".clone()
}
Clone this wiki locally