Empty string: Difference between revisions
Content added Content deleted
No edit summary |
m (→{{header|REXX}}: remove some blank lines. -- ~~~~) |
||
Line 599: | Line 599: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
⚫ | |||
<lang rexx> |
|||
⚫ | |||
/*─────────────── 3 simple wats to assign an empty string to a variable.*/ |
/*─────────────── 3 simple wats to assign an empty string to a variable.*/ |
||
Line 607: | Line 605: | ||
ide="" /*uses two quotes, sometimes called a double quote.*/ |
ide="" /*uses two quotes, sometimes called a double quote.*/ |
||
doe= /*... nothing at all. */ |
doe= /*... nothing at all. */ |
||
/*─────────────── assigning multiple null values to vars, 2 methods are:*/ |
/*─────────────── assigning multiple null values to vars, 2 methods are:*/ |
||
Line 617: | Line 614: | ||
parse value 0 with . ant ape ant imp fly tui paa elo dab cub bat ayu |
parse value 0 with . ant ape ant imp fly tui paa elo dab cub bat ayu |
||
/*where the value of zero is skipped, the rest set to null.*/ |
/*where the value of zero is skipped, the rest set to null.*/ |
||
/*─────────────── how to check that a string is empty, several methods: */ |
/*─────────────── how to check that a string is empty, several methods: */ |
||
if cat=='' then say "the feline is not here." |
if cat=='' then say "the feline is not here." |
||
if pig=="" then say 'no ham today' |
if pig=="" then say 'no ham today' |
||
Line 629: | Line 624: | ||
nit='' /*assign an empty string to a lice egg.*/ |
nit='' /*assign an empty string to a lice egg.*/ |
||
if cow==nit then say 'the cow has no milk today.' |
if cow==nit then say 'the cow has no milk today.' |
||
/*─────────────── how to check that a string isn't empty, several ways: */ |
/*─────────────── how to check that a string isn't empty, several ways: */ |
||
if dog\=='' then say "the dogs are out!" |
if dog\=='' then say "the dogs are out!" |
||
/*most REXXes support the "not" character.*/ |
/*most REXXes support the "not" character.*/ |
||
Line 644: | Line 636: | ||
if length(cod)\=0 then fish=cod /*not-so-fast compare.*/ |
if length(cod)\=0 then fish=cod /*not-so-fast compare.*/ |
||
⚫ | |||
⚫ | |||
</lang> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |