Jump to content

Empty string: Difference between revisions

→‎{{header|Perl 6}}: Add Perl 6 example
(+Java)
(→‎{{header|Perl 6}}: Add Perl 6 example)
Line 18:
System.out.println("s is not empty");
}</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}}==
<lang python>s = ''
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.