diff --git a/defer_statement/demo1.go b/defer_statement/demo1.go new file mode 100644 index 0000000..c648b2d --- /dev/null +++ b/defer_statement/demo1.go @@ -0,0 +1,13 @@ +package defer_statement + +import "fmt" + +func A() { + fmt.Println("A function worked") +} + +func B() { + fmt.Println("B function worked") + A() +} + diff --git a/main.go b/main.go index 20d9132..c489deb 100644 --- a/main.go +++ b/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() + }