Delete Line Numbers Error (2024-03-05 02:15 by toml12953 #754664)
In the following program, the line number (140) after GOSUB 170 should not be removed but it is. After I added the 140 back in, the program works fine:
SET bitmap size 320,200
SET WINDOW 0,319,0,199
SET COLOR MIX(0) 0,0,0
SET POINT COLOR 15
SET LINE COLOR 0
SET POINT STYLE 1
CLEAR
LET P=160
LET Q=100
LET XP=144
LET XR=1.5*3.1415927
LET YP=56
LET YR=1
LET ZP=64
LET XF=XR/XP
LET YF=YP/YR
LET ZF=XR/ZP
FOR ZI=-Q TO Q-1
IF ZI<-ZP OR ZI>ZP THEN GOTO 150
LET ZT=ZI*XP/ZP
LET ZZ=ZI
LET XL=INT(.5+SQR(XP*XP-ZT*ZT))
FOR XI=-XL TO XL
LET XT=SQR(XI*XI+ZT*ZT)*XF
LET XX=XI
LET YY=(SIN(XT)+.4*SIN(3*XT))*YF
GOSUB 170
140 NEXT XI ! ********************** The number on this line shouldn't be removed!!! ***************************
150 NEXT ZI
STOP
170 LET X1=XX+ZZ+P
LET Y1=YY-ZZ+Q
PLOT POINTS: X1,Y1
IF Y1 = 0 THEN GOTO 220
PLOT LINES: X1,Y1-1; X1,0
220 RETURN
END
Re: Delete Line Numbers Error (2024-03-05 08:31 by SHIRAISHI Kazuo #754665)
Thanks for the information.
Edit - Delete Line Numbers command remains applicable only for Decimal BASIC.
In BASICAcc and Paract BASIC, Programs that include GOSUB are recommended to have line numbers in all lines.
Reply To Message #754664
> In the following program, the line number (140) after GOSUB 170 should not be removed but it is. After I added the 140 back in, the program works fine:
>
> SET bitmap size 320,200
> SET WINDOW 0,319,0,199
> SET COLOR MIX(0) 0,0,0
> SET POINT COLOR 15
> SET LINE COLOR 0
> SET POINT STYLE 1
> CLEAR
> LET P=160
> LET Q=100
> LET XP=144
> LET XR=1.5*3.1415927
> LET YP=56
> LET YR=1
> LET ZP=64
> LET XF=XR/XP
> LET YF=YP/YR
> LET ZF=XR/ZP
> FOR ZI=-Q TO Q-1
> IF ZI<-ZP OR ZI>ZP THEN GOTO 150
> LET ZT=ZI*XP/ZP
> LET ZZ=ZI
> LET XL=INT(.5+SQR(XP*XP-ZT*ZT))
> FOR XI=-XL TO XL
> LET XT=SQR(XI*XI+ZT*ZT)*XF
> LET XX=XI
> LET YY=(SIN(XT)+.4*SIN(3*XT))*YF
> GOSUB 170
> 140 NEXT XI ! ********************** The number on this line shouldn't be removed!!! ***************************
> 150 NEXT ZI
> STOP
> 170 LET X1=XX+ZZ+P
> LET Y1=YY-ZZ+Q
> PLOT POINTS: X1,Y1
> IF Y1 = 0 THEN GOTO 220
> PLOT LINES: X1,Y1-1; X1,0
> 220 RETURN
> END