Comma quibbling: Difference between revisions
Content added Content deleted
ReeceGoding (talk | contribs) (Added R.) |
No edit summary |
||
Line 4,169: | Line 4,169: | ||
{ABC and DEF} |
{ABC and DEF} |
||
{ABC, DEF, G and H} |
{ABC, DEF, G and H} |
||
</pre> |
|||
=={{header|XBS}}== |
|||
<lang>func task(a:array){ |
|||
set x:string=""; |
|||
foreach(k,v as a){ |
|||
set out:string=""; |
|||
if ((k==(?a-2))&((?a)>1)){out=" and "}elif(k!=(?a-1)){out=", "} |
|||
x+=v+out;del out; |
|||
} |
|||
send "{"+x+"}"; |
|||
} |
|||
log(task([])); |
|||
log(task(["ABC"])); |
|||
log(task(["ABC","DEF"])); |
|||
log(task(["ABC","DEF","GHI"]));</lang> |
|||
{{out}} |
|||
<pre> |
|||
{} |
|||
{ABC} |
|||
{ABC and DEF} |
|||
{ABC, DEF and GHI} |
|||
</pre> |
</pre> |
||