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);

It's your homework to do that, not ours.

commented: Yes, maybe true. +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.