14 lines
249 B
Go
14 lines
249 B
Go
// define and initialize an empty string
|
|
var s string
|
|
s2 := ""
|
|
|
|
// assign an empty string to a variable
|
|
s = ""
|
|
|
|
// check that a string is empty, any of:
|
|
s == ""
|
|
len(s) == 0
|
|
|
|
// check that a string is not empty, any of:
|
|
s != ""
|
|
len(s) != 0 // or > 0
|