RosettaCodeData/Task/Comma-quibbling/M2000-Interpreter/comma-quibbling-2.m2000
2023-07-01 13:44:08 -04:00

14 lines
420 B
Text

Module Checkit {
function f$ {
what$=filter$(trim$(letter$), chr$(34))
what$=Mid$(what$, 2, len(what$)-2)
count=Len(what$)-Len(filter$(what$,","))
if count>2 then m=rinstr(what$, ", ") : insert m, 2 what$=" and "
="{"+what$+"}"
}
? f$({[]})
? f$({["ABC"]})
? f$({["ABC", "DEF"]})
? f$({["ABC","DEF", "G", "H"]})
}
Checkit