All those GOTO statements make my teeth crunch up and hurt! /cry!
Here, try this in a much, much, much, much simpler way:
Looks like a lot of code, but it's mainly just all comments.
Here, try this in a much, much, much, much simpler way:
Code: (Select All)
'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.
'
Do
Print "Input the correct value, by the rules! =>";
Do
a$ = Input$(1)
Select Case a$
Case "0" To "7"
If Len(num$) < 7 Then
Print a$;: num$ = num$ + a$
Else
finished = -1 'the 7 digit sequence is to be approved automagically
End If
If Len(num$) = 1 And a$ = "0" Then finished = -1 'zero needs no confirmation
'Is zero an unique case that resets the value to 0, no matter when it appears???
'In other words, is "10" counted as 10, or does that 0 void it out and make it a 0 automatically?
'The rules aren't the most specific on this point.
'If a$ = "0" Then num$ = "0": finished = -1 'this rule makes 0 a pure "reset" value, if it's necessary
Case Chr$(13) 'enter
If Len(num$) > 1 Then finished = -1 'if less than 7 digits, enter confirms
End Select
Loop Until finished
Print
Print "Your number as entereed was: "; num$
finished = 0: num$ = "" 'reset the variables
Loop 'forever and ever and ever... or until you hit the big red X to close the program.
Looks like a lot of code, but it's mainly just all comments.