RosettaCodeData/Task/Comma-quibbling/CoffeeScript/comma-quibbling.coffee
2023-07-01 13:44:08 -04:00

9 lines
260 B
CoffeeScript

quibble = ([most..., last]) ->
'{' +
(most.join ', ') +
(if most.length then ' and ' else '') +
(last or '') +
'}'
console.log quibble(s) for s in [ [], ["ABC"], ["ABC", "DEF"],
["ABC", "DEF", "G", "H" ] ]