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

23 lines
402 B
Text

#!/usr/bin/lasso9
local(collection =
array(
array,
array("ABC"),
array("ABC", "DEF"),
array("ABC", "DEF", "G", "H")
)
)
with words in #collection do {
if(#words -> size > 1) => {
local(last = #words -> last)
#words -> removelast
stdoutnl('{' + #words -> join(', ') + ' and ' + #last'}')
else(#words -> size == 1)
stdoutnl('{' + #words -> first + '}')
else
stdoutnl('{}')
}
}