Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correcting the code
#1
The code is intended to work as follows: when only the Enter key is pressed, the variable (H#) cannot be set to zero. However, when the zero (0) key is pressed, the variable (H#) is supposed to have a zero value. But if the entered number is 1,2,3,4,5,6 digits, it is to be confirmed with the Enter key. However, the 7-digit number is to be approved automatically.
To sum up, the entered numbers may have the following values: 0, 11, 232, 1254, 36547, 325478, 3254657.

H$ = "": B$ = ""
WHILE LEN(H$) < 7 AND B$ <> CHR$(13)
    B$ = ""
    WHILE B$ = "": B$ = INKEY$: _LIMIT 30: WEND
    IF B$ = CHR$(27) THEN 4200
    IF B$ = CHR$(32) THEN 8425
    IF B$ = CHR$(45) THEN 6171
    IF B$ = CHR$(43) THEN 6172
    IF B$ = CHR$(81) OR B$ = CHR$(113) THEN 6304
    IF B$ = CHR$(65) OR B$ = CHR$(97) THEN 6305
    IF B$ = CHR$(87) OR B$ = CHR$(119) THEN 6306
    IF B$ = CHR$(83) OR B$ = CHR$(115) THEN 6307
    IF B$ = CHR$(69) OR B$ = CHR$(101) THEN 6308
    IF B$ = CHR$(68) OR B$ = CHR$(100) THEN 6309
    IF B$ = CHR$(82) OR B$ = CHR$(114) THEN 6310
    IF B$ = CHR$(70) OR B$ = CHR$(102) THEN 6311
    IF B$ <> CHR$(13) THEN H$ = H$ + B$
WEND
H# = VAL(H$): PRINT H#

Thank you for your help - regards
Reply


Messages In This Thread
Correcting the code - by Chris - 10-27-2023, 07:19 PM
RE: Correcting the code - by bplus - 10-27-2023, 08:28 PM
RE: Correcting the code - by SMcNeill - 10-27-2023, 09:31 PM
RE: Correcting the code - by Chris - 10-28-2023, 06:34 AM
RE: Correcting the code - by SMcNeill - 10-28-2023, 01:46 PM
RE: Correcting the code - by Stuart - 10-28-2023, 10:43 AM
RE: Correcting the code - by Chris - 10-28-2023, 11:34 AM
RE: Correcting the code - by Chris - 10-28-2023, 11:49 AM
RE: Correcting the code - by bplus - 10-28-2023, 12:55 PM
RE: Correcting the code - by Chris - 10-28-2023, 02:13 PM
RE: Correcting the code - by bplus - 10-28-2023, 02:46 PM
RE: Correcting the code - by SMcNeill - 10-28-2023, 06:18 PM
RE: Correcting the code - by Chris - 10-28-2023, 07:44 PM
RE: Correcting the code - by bplus - 10-28-2023, 07:47 PM
RE: Correcting the code - by SMcNeill - 10-28-2023, 09:48 PM
RE: Correcting the code - by bplus - 10-28-2023, 07:51 PM



Users browsing this thread: 8 Guest(s)