repl.it
@MayankGupta5/

panic_defer.go

Go

No description

fork
loading
Files
  • main.go
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import "fmt"

func recoveryFunction() {
  fmt.Println("This is recovery function...")
}

func executePanic() {
  defer recoveryFunction()
  panic("This is Panic Situation")
  fmt.Println("The function executes Completely")  
}

func main() {
  executePanic()
  fmt.Println("Main block is executed completely...")
}