Empty string: Difference between revisions
Content deleted Content added
Added Robotic implementation to Empty string |
|||
Line 2,029: | Line 2,029: | ||
The empty string is printed by Python REPL as <nowiki>''</nowiki>, and is treated as boolean false (as are most empty container types, by convention). Any non-empty ''string'', including '0', is always treated as True in a boolean context. |
The empty string is printed by Python REPL as <nowiki>''</nowiki>, and is treated as boolean false (as are most empty container types, by convention). Any non-empty ''string'', including '0', is always treated as True in a boolean context. |
||
<lang python>s = '' |
<lang python>s = '' |
||
if |
if len(s) == 0: |
||
print( |
print("String is empty") |
||
else: |
|||
if s: |
|||
print( |
print("String not empty") |
||
=={{header|R}}== |
=={{header|R}}== |