RosettaCodeData/Task/Empty-string/Go/empty-string-1.go

15 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