Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 1 of 1 for defer (0.01 seconds)

  1. doc/go_spec.html

    </p>
    
    <pre>
    lock(l)
    defer unlock(l)  // unlocking happens before surrounding function returns
    
    // prints 3 2 1 0 before surrounding function returns
    for i := 0; i &lt;= 3; i++ {
    	defer fmt.Print(i)
    }
    
    // f returns 42
    func f() (result int) {
    	defer func() {
    		// result is accessed after it was set to 6 by the return statement
    		result *= 7
    Created: Tue Dec 30 11:13:12 GMT 2025
    - Last Modified: Tue Dec 02 23:07:19 GMT 2025
    - 286.5K bytes
    - Click Count (1)
Back to Top