For homework in turbo pascal I have to find a some bugs and refactor them. I need some help changing this so that it does the same thing which is to remove comments without the excessive code.
k:=0;
for i:=length(s) downto 1 do
if s[i]=' ; ' then k:=i;
if k>0 then s:=lstr(s,k-1);