Empty string: Difference between revisions
Content added Content deleted
(added a solution for Factor) |
No edit summary |
||
Line 1,395: | Line 1,395: | ||
if (isEmpty(s)) print("string s is empty"); |
if (isEmpty(s)) print("string s is empty"); |
||
if (isEmpty(s)) print("string s is not empty");</lang> |
if (isEmpty(s)) print("string s is not empty");</lang> |
||
=={{header|Red}}== |
|||
<lang Red>Red [] |
|||
s: copy "" ;; assign empty string |
|||
?? s |
|||
if empty? s [print "string is empty "] ;; check if string is empty |
|||
s: "abc" |
|||
prin s unless empty? s [print " not empty"] |
|||
</lang> |
|||
{{out}} |
|||
<pre>s: "" |
|||
string is empty |
|||
abc not empty |
|||
>> |
|||
</pre> |
|||
=={{header|Retro}}== |
=={{header|Retro}}== |
||
Create an empty string and assign it to a variable. In these '''keepString''' is used to ensure that the string is permanent. |
Create an empty string and assign it to a variable. In these '''keepString''' is used to ensure that the string is permanent. |
||
<lang Retro> |
<lang Retro> |
||
( by creating a variable ) |
( by creating a variable ) |