Skip to main content
← Back to Code Arena
Medium Apprentice SpeedRun defer control-flow

Go: Defer Execution Order

+150 XP · 6 min · attempt 1

Problem

What exact string is printed by main()? Enter the output with no spaces and no newline.

    func main() {
        defer fmt.Print("A")
        defer fmt.Print("B")
        defer fmt.Print("C")
        fmt.Print("D")
    }

Starter

// Deferred calls run in LIFO order when the function returns.
// Non-deferred prints run inline.

Your answer

Log in to submit