Empty string: Difference between revisions

Content added Content deleted
(+Java)
(→‎{{header|Perl 6}}: Add Perl 6 example)
Line 18: Line 18:
System.out.println("s is not empty");
System.out.println("s is not empty");
}</lang>
}</lang>
=={{header|Perl 6}}==
In Perl 6 we can't just test a string for truth to determine if it has a value. The string "0" will test as false even though it has a value. Instead we must test for length.

<lang perl6>my $s = '';
say 'String is empty' unless $s.chars;
say 'String is not empty' if $s.chars;</lang>

=={{header|Python}}==
=={{header|Python}}==
<lang python>s = ''
<lang python>s = ''