What is the best way to print a dynamic list with ‘and’ or ‘or’ before the final item? I can make a list with a dynamic string or just appending text conditionally no problem, but can’t figure out how to detect the final item and print ‘and’ before it (without a lot of laborious checking of flags to see what is still in the list and printing ‘and [item]’ rather than [item] if it happens to be the last thing):
apple, pear, banana and orange
apple, pear and banana.
Will the built in list or set function do it (somehow) automatically? I know those are there, but they are undocumented in the manual. If it comes to it, I can live with an apple, pear, banana, orange list. But it niggles.