17 lines
369 B
Text
17 lines
369 B
Text
|
|
fun main() {
|
||
|
|
mut e := "" // Declare empty string
|
||
|
|
e = "" // Assign empty string
|
||
|
|
|
||
|
|
// Use either condition to check if the string is empty
|
||
|
|
if e == "" and e.length == 0 {
|
||
|
|
println("`e` is an empty string")
|
||
|
|
}
|
||
|
|
|
||
|
|
s := "not empty"
|
||
|
|
|
||
|
|
// Use either condition to check if the string is _not_ empty
|
||
|
|
if s != "" and s.length > 0 {
|
||
|
|
println("`s` is not an empty string")
|
||
|
|
}
|
||
|
|
}
|