18 lines
237 B
Go
18 lines
237 B
Go
package learning
|
|
|
|
import "fmt"
|
|
|
|
func DeferLearn() {
|
|
defer fmt.Println("world")
|
|
fmt.Println("hello")
|
|
}
|
|
|
|
func DeferStackingLearn() {
|
|
fmt.Println("counting")
|
|
|
|
for i := 0; i < 10; i++ {
|
|
defer fmt.Println(i)
|
|
}
|
|
|
|
fmt.Println("Done!")
|
|
}
|