Comma quibbling: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 73: Line 73:


=={{header|Rexx}}==
=={{header|Rexx}}==
<lang Rexx>>>>
<lang Rexx>
say quibbling('ABC')
say quibbling('ABC')
say quibbling('ABC DEF')
say quibbling('ABC DEF')
Line 83: Line 83:
if words(list) < 2 then return list
if words(list) < 2 then return list
return translate(strip(subword(list,1,words(list)-1)),',',' ') 'and' word(list,words(list))
return translate(strip(subword(list,1,words(list)-1)),',',' ') 'and' word(list,words(list))
</lang>


{{out}}
Output:
<pre>{}
ABC
ABC and DEF
{ABC}
ABC,DEF,G and H
{ABC and DEF}
{ABC,DEF,G and H}</pre>
>>> </lang>