Comma quibbling: Difference between revisions

add SETL
(Added Easylang)
(add SETL)
Line 4,291:
{ABC, DEF, G and H}
</pre>
=={{header|SETL}}==
<syntaxhighlight lang="setl">program comma_quibbling;
tests := [
[],
["ABC"],
["ABC","DEF"],
["ABC","DEF","G","H"]
];
 
loop for t in tests do
print(t, "=", quibble(t));
end loop;
 
proc quibble(words);
ret := '{';
loop while words /= [] do
word fromb words;
ret +:= word;
case of
(#words = 1):
ret +:= " and ";
(#words > 1):
ret +:= ", ";
end case;
end loop;
return ret + '}';
end proc;
end program;</syntaxhighlight>
{{out}}
<pre>[] = {}
[ABC] = {ABC}
[ABC DEF] = {ABC and DEF}
[ABC DEF G H] = {ABC, DEF, G and H}</pre>
 
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">func comma_quibbling(words) {
2,114

edits