25 lines
559 B
Go
25 lines
559 B
Go
// Copyright © 2018 Inanc Gumus
|
|
// Learn Go Programming Course
|
|
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
//
|
|
// For more tutorials : https://learngoprogramming.com
|
|
// In-person training : https://www.linkedin.com/in/inancgumus/
|
|
// Follow me on twitter: https://twitter.com/inancgumus
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
)
|
|
|
|
func main() {
|
|
if n, err := strconv.Atoi("42"); err == nil {
|
|
// n and err are available here
|
|
fmt.Println("There was no error, n is", n)
|
|
}
|
|
|
|
// n and err are not available here
|
|
// fmt.Println(n, err)
|
|
}
|