golangHow to declare string constant
package main
const president string = "Joe" 
func main() {
  print(president)
}ctrl + c| package maindefault package declaration | func main() {declare  | 
| constdefines constant value | presidentname of the constant | 
| string =constant type | Joeconstant value | 
Usage example
package main
const president string = "Joe" 
func main() {
  print(president)
}output
JoeMore of Golang
- How to generate random string
- How to convert map to JSON
- How to generate random float
- How to iterate over a slice in reverse order
- How to make POST (form data) request using HTTP client
- Find the nameserver records of a domain name
- How to sleep for 500 milliseconds
- How to use proxy with HTTP client
- How to set user agent for HTTP request
- How to sleep for 1 minute
See more codes...