Javatpoint Logo
Javatpoint Logo

Go Recover

Recover is used to regain control of a program from panic or error-condition. It stops the terminating sequence and resumes the normal execution. It is called from the deferred function. It retrieves the error value passed through the call of panic. Normally, it returns nil which has no other effect.

Go recover() Example

Output:

runtime error: integer divide by zero
0
<nil>
1

Next TopicGo Defer





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA