10-28-2023, 06:34 AM
Thank You very much, it works, but a small correction is still needed. As I wrote earlier, after pressing only the Enter key, the H# variable cannot have the value zero (0). After entering the value zero (0) it is ok, after entering any number it is ok, but when I press only the Enter key it takes the value zero (0) and that is not good. I am asking for an amendment so that after pressing only the Enter key, the H# variable takes the value N#, i.e. H# = N#. The value of N# is calculated before the loop. If you fix it, it will be great. I removed unnecessary lines. Thank you.
H$ = "": B$ = ""
WHILE LEN(H$) < 7
B$ = ""
WHILE B$ = ""
B$ = INKEY$
_LIMIT 30
WEND
IF B$ = Chr$(27) THEN END
IF B$ = "-" THEN
IF H$ = "" THEN H$ = "-" ELSE BEEP
ENDIF
IF INSTR("0123456789", B$) THEN H$ = H$ + B$
IF B$ = CHR$(13) THEN EXIT WHILE
_LIMIT 30
WEND
H# = VAL(H$): PRINT H#
H$ = "": B$ = ""
WHILE LEN(H$) < 7
B$ = ""
WHILE B$ = ""
B$ = INKEY$
_LIMIT 30
WEND
IF B$ = Chr$(27) THEN END
IF B$ = "-" THEN
IF H$ = "" THEN H$ = "-" ELSE BEEP
ENDIF
IF INSTR("0123456789", B$) THEN H$ = H$ + B$
IF B$ = CHR$(13) THEN EXIT WHILE
_LIMIT 30
WEND
H# = VAL(H$): PRINT H#