B and A function worked defer statement
This commit is contained in:
parent
6e181a1024
commit
91ed99722f
2 changed files with 17 additions and 0 deletions
13
defer_statement/demo1.go
Normal file
13
defer_statement/demo1.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package defer_statement
|
||||
|
||||
import "fmt"
|
||||
|
||||
func A() {
|
||||
fmt.Println("A function worked")
|
||||
}
|
||||
|
||||
func B() {
|
||||
fmt.Println("B function worked")
|
||||
A()
|
||||
}
|
||||
|
4
main.go
4
main.go
|
@ -5,6 +5,7 @@ import (
|
|||
"golesson/arrays"
|
||||
"golesson/channels"
|
||||
"golesson/conditionals"
|
||||
"golesson/defer_statement"
|
||||
"golesson/examplerange"
|
||||
"golesson/functions"
|
||||
"golesson/goroutines"
|
||||
|
@ -79,4 +80,7 @@ func main() {
|
|||
|
||||
interfaces.Demo1()
|
||||
interfaces.Demo2()
|
||||
|
||||
defer_statement.B()
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue