Comma quibbling: Difference between revisions
Content added Content deleted
imported>Rowsety Moid No edit summary |
(Added Easylang) |
||
Line 1,466: | Line 1,466: | ||
"{ABC and DEF}" |
"{ABC and DEF}" |
||
"{ABC, DEF, G and H}"</pre> |
"{ABC, DEF, G and H}"</pre> |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight> |
|||
func$ tolist s$ . |
|||
s$[] = strsplit s$ " " |
|||
r$ = "{" |
|||
n = len s$[] |
|||
for i = 1 to n - 2 |
|||
r$ &= s$[i] & ", " |
|||
. |
|||
if n > 0 |
|||
if n > 1 |
|||
r$ &= s$[n - 1] & " and " |
|||
. |
|||
r$ &= s$[n] |
|||
. |
|||
r$ &= "}" |
|||
return r$ |
|||
. |
|||
print tolist "" |
|||
print tolist "ABC" |
|||
print tolist "ABC DEF" |
|||
print tolist "ABC DEF G H" |
|||
</syntaxhighlight> |
|||
=={{header|EchoLisp}}== |
=={{header|EchoLisp}}== |