03_correct_recover

command
v0.0.0-...-b94188f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

This example illustrates the use of a recover statement to capture a panic. Because deferred statements are executed after the function has completed evaluation, they can be used to handle a panic statement using the built-in recover function. This function will return the "value" of the panic as an `any` value (or nil, if there was no panic). Once recover has been called, the panic is effectively stopped, and the function will return zero values for any of its return types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL