Empty string: Difference between revisions

Content added Content deleted
(→‎{{header|Perl 6}}: Added PureBasic)
(Added PicoLisp)
Line 119: Line 119:
say 'String is empty' unless $s.chars;
say 'String is empty' unless $s.chars;
say 'String is not empty' if $s.chars;</lang>
say 'String is not empty' if $s.chars;</lang>

=={{header|PicoLisp}}==
The empty string is represented by '[http://software-lab.de/doc/ref.html#nilSym NIL]' in PicoLisp. During input, two subsequent double qoutes '""' return the symbol NIL.
<lang PicoLisp># To assign a variable an empty string:
(off String)
(setq String "")
(setq String NIL)

# To check for an empty string:
(or String ..)
(ifn String ..)
(unless String ..)

# or a non-empty string:
(and String ..)
(if String ..)
(when String ..)</lang>

=={{header|PureBasic}}==
=={{header|PureBasic}}==
In PureBasic we can just test a string for truth to determine if it has a value.
In PureBasic we can just test a string for truth to determine if it has a value.