Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Exceptions/Go/exceptions.go
Normal file
22
Task/Exceptions/Go/exceptions.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func foo() int {
|
||||
fmt.Println("let's foo...")
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
fmt.Println("Recovered from", e)
|
||||
}
|
||||
}()
|
||||
var a []int
|
||||
a[12] = 0
|
||||
fmt.Println("there's no point in going on.")
|
||||
panic("never reached")
|
||||
panic(fmt.Scan) // Can use any value, here a function!
|
||||
}
|
||||
|
||||
func main() {
|
||||
foo()
|
||||
fmt.Println("glad that's over.")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue