This is a way to do the same example using a for loop. It might be easier to read and understand.
Code:
program:
sample_input = 'Bus, Car, Starship, Ferry, Ferry Terminal, Alien Spacecraft';
output = '';
for item in sample_input:
if item == 'bus' then ni = 'Public Transport'
elif item == 'ferry' then ni = 'Vehicle'
elif item == 'starship' then ni = 'Vehicle'
else ni = item
fi;
output = output & ',' & ni
rof;
output = list_remove_duplicates(output, ',')
The output is
Code:
Public Transport, Car, Vehicle, Ferry Terminal, Alien Spacecraft
You can sort the list if you want with
Code:
output = list_sort(list_remove_duplicates(output, ','), 0, ',')
Now the output is
Code:
Alien Spacecraft, Car, Ferry Terminal, Public Transport, Vehicle