Theruler76 - 2021-09-03

Hi, I just wanted to share with the pcbasic community two ways to delete a line or part of it I just used in a program of mine.
the goal is to have a subroutine you can use in multiple position around your program just passing to it two variables: Y the line you want to delete and X the point where you want to start deleting.
The only drawback is that you can delete only from a point to the end of line, not let's say ten characters at the center of a line.

this code uses a for cycle to locate a fixxed Y and a subsequent X a "space" character.

10 Y=1:X=1:GOSUB 20:END
20 FOR A=X TO 80:LOCATE Y,A:?" ";:NEXT:RETURN

the second code runs much faster due to the use of STRING$ command instead of FOR cycle:

10 Y=1:X=1:GOSUB 20:END
20 LOCATE Y,X:?STRING$(80-X,32);:RETURN

And if you want to delete more lines in a single command you could use VIEW:

VIEW ?10 TO 20:CLS:VIEW ?

this code clear all the lines starting from 10th down to 20th.