golangUsing panic() in program
Usage example
package main
func main() {
age := 90
if age > 50 {
panic("Naah, too old")
}
}
output
panic: Naah, too old
goroutine 1 [running]:
main.main()
/tmp/test.go:6 +0x27
exit status 2
More of Golang
- How to sleep for 500 milliseconds
- How to use proxy with HTTP client
- How to make POST (form data) request using HTTP client
- How to generate UUID and convert it to string
- How to generate random int
- How to do case-insensitive regexp
- Marshal example
- How to print new line with printf()
- Find the nameserver records of a domain name
- How to get JSON data from HTTP request
See more codes...