Empty string: Difference between revisions

Content added Content deleted
(Added PicoLisp)
m (I don't know Tcl but I guess this is a typo)
Line 172: Line 172:
<lang tcl>set s ""
<lang tcl>set s ""
if {$s eq ""} {puts "s contains an empty string"}
if {$s eq ""} {puts "s contains an empty string"}
if {$s ne ""} {phts "s contains a non-empty string"}</lang>
if {$s ne ""} {puts "s contains a non-empty string"}</lang>
There are other ways to check for emptiness and non-emptiness too (though the above are favored for reasons of simplicity, clarity and speed):
There are other ways to check for emptiness and non-emptiness too (though the above are favored for reasons of simplicity, clarity and speed):
<lang tcl>if {[string equal $s ""]} {puts "is empty"}
<lang tcl>if {[string equal $s ""]} {puts "is empty"}