redo from start
redo from start
Somewhere on this huge board I'm sure the answer lies, but I cannot find it. So, here goes....
When entering a response to a question that wants a numerical value. If the user accidently types a letter you would get `redo from start?'
So, my question is: How would you stop the error message from popping up, and simply make it loop back to the question without making it look messy?
thanks for any help.
When entering a response to a question that wants a numerical value. If the user accidently types a letter you would get `redo from start?'
So, my question is: How would you stop the error message from popping up, and simply make it loop back to the question without making it look messy?
thanks for any help.
I won't give you the code (to lazy ) but I will give you the steps.
#1>Input as STRING
#2>Check for letters, if there are, loop
#3>No letters, convert the string to #s. I dunno the function.
KNOW: MID$, INPUT$, IF, GOTO, DO, LOOP, GOSUB, and Something I don't.
OK... so the KNOW section was stupid. I don't care
#1>Input as STRING
#2>Check for letters, if there are, loop
#3>No letters, convert the string to #s. I dunno the function.
KNOW: MID$, INPUT$, IF, GOTO, DO, LOOP, GOSUB, and Something I don't.
OK... so the KNOW section was stupid. I don't care
Code: Select all
Do
Input "Enter any number to exit: ", value$
If LTrim$(Str$(Val(Value$) ) ) = value$ Then exit Do
Loop
value = Val(Value$)
I have left this dump.
- Mitth'raw'nuruodo
- Veteran
- Posts: 839
- Joined: Sat Jan 22, 2005 11:04 am
- Location: Eastern Coast of US
- Contact:
-
- Veteran
- Posts: 1055
- Joined: Sun Jan 02, 2005 2:11 pm
- Location: At my computer
- Contact:
You also need to check for commas.. I get a "Redo from start" every time I use a comma. This happens since a comma is used for to variables:
So if you use a comma and only have one variable, it messes up.. So it also needs a comma check to if that can be fabricated..
Code: Select all
INPUT "Q"; num1, num2
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
(x.t.r.GRAPHICS)
Code: Select all
Do
Line Input "Enter any number to exit: ", value$
If LTrim$(Str$(Val(Value$) ) ) = value$ Then exit Do
Loop
value = Val(Value$)
And it convert to number, then to string to check if it's the same. consider:
Value$ = "23A"
VAL(Value$) = 0
LTRIM$(STR$(VAL(Value$))) = "0"
If "0" = "23A" Then Exit Do
I have left this dump.
- Mitth'raw'nuruodo
- Veteran
- Posts: 839
- Joined: Sat Jan 22, 2005 11:04 am
- Location: Eastern Coast of US
- Contact:
-
- Veteran
- Posts: 1055
- Joined: Sun Jan 02, 2005 2:11 pm
- Location: At my computer
- Contact:
Yeah, I was playing with INPUT, MID$, LEN, and those others after Nathans bug (Not making a parser system, no way ,.) Not going to say what I'm trying to make with 'em tho,.
I noticed it when applying them in a CHAT style app, if I used a "," it messed up.. , LINE INPUT, that will help, but I'm off the CHAT thing for now.. hehe I'm on the secret one..
I noticed it when applying them in a CHAT style app, if I used a "," it messed up.. , LINE INPUT, that will help, but I'm off the CHAT thing for now.. hehe I'm on the secret one..
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
(x.t.r.GRAPHICS)
- Mitth'raw'nuruodo
- Veteran
- Posts: 839
- Joined: Sat Jan 22, 2005 11:04 am
- Location: Eastern Coast of US
- Contact:
-
- Veteran
- Posts: 1055
- Joined: Sun Jan 02, 2005 2:11 pm
- Location: At my computer
- Contact:
- Mitth'raw'nuruodo
- Veteran
- Posts: 839
- Joined: Sat Jan 22, 2005 11:04 am
- Location: Eastern Coast of US
- Contact:
-
- Veteran
- Posts: 1055
- Joined: Sun Jan 02, 2005 2:11 pm
- Location: At my computer
- Contact:
- Mitth'raw'nuruodo
- Veteran
- Posts: 839
- Joined: Sat Jan 22, 2005 11:04 am
- Location: Eastern Coast of US
- Contact: