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 2More of Golang
- How to print new line with printf()
- How to generate random string
- How to generate random int
- How to set user agent for HTTP request
- How to sleep for 1 second
- How to make POST (form data) request using HTTP client
- How to do case-insensitive regexp
- Unrmarshal example
- Marshal example
- How to sleep for 5 seconds
See more codes...