Testing for an undefined string in Go
This is an example Go program which illustrates testing for an undefined string.
package main import ( "fmt" ) func main() { var s string var t string s = "bubba" if s == "" { fmt.Println("s is empty") } if t == "" { fmt.Println("t is empty") } }
The output of the example looks like this:
t is empty
Web links
Copyright © Ben Bullock 2009-2024. All
rights reserved.
For comments, questions, and corrections, please email
Ben Bullock
(benkasminbullock@gmail.com).
/
Privacy /
Disclaimer