lmao it worked

This commit is contained in:
Mark McGranaghan
2012-09-23 13:11:11 -07:00
parent 6488f3d77c
commit 5f9b4d2eb4
78 changed files with 0 additions and 0 deletions

24
051-errors/errors.go Normal file
View File

@@ -0,0 +1,24 @@
// ## Errors
package main
import ("fmt"; "errors")
func myFun(arg int) (int, error) {
if arg == 42 {
return -1, errors.New("Can't work with 42")
}
return arg + 3, nil
}
func main() {
r, _ := myFun(7)
fmt.Println(r)
_, e := myFun(42)
fmt.Println(e)
}
// todo: custom errors
// todo: data conveying errors