Advertisement
cwchen

[Go] Terminating the program on error.

Oct 28th, 2017
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.16 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "log"
  6.     "strconv"
  7. )
  8.  
  9. func main() {
  10.     n, err := strconv.Atoi("hello")
  11.     if err != nil {
  12.         log.Fatal(err)
  13.     }
  14.  
  15.     fmt.Println(n)
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement