Go Error Using Errorf In Golang

[Solved] Go Error Using Errorf In Golang | Erlang - Code Explorer | yomemimo.com
Question : Go Error using Errorf() in Golang

Answered by : samer-saeid

package main
import "fmt"
func main() { age := -14 // creating an error using Efforf() error := fmt.Errorf("%d is negative\nAge can't be negative", age) if age < 0 { fmt.Println(error) } else { fmt.Println("Age: %d", age); }
}

Source : | Last Update : Thu, 23 Jun 22

Answers related to go error using errorf in golang

Code Explorer Popular Question For Erlang