Programming Newbie Help
I need help with paralax· basic stamp homework board. I am familier with old GW Basic from the old days of DOS and I use to be good. Now that I have been assigned a new project utilizing· PAralax controllers, I· NEED HELP.
Could anyone tell me how I would transcribe the the following GW BASIC statement into V2.5
1Dim x$
2 input x$
10 If x = 1 then goto 20
11 if x· = 2 then goto 30
12 if x =· 3 then goto·40
13 goto 2
Thanks again to anyone who can help. I have now used BASIC in years and it was always my favorite.
Pete
Could anyone tell me how I would transcribe the the following GW BASIC statement into V2.5
1Dim x$
2 input x$
10 If x = 1 then goto 20
11 if x· = 2 then goto 30
12 if x =· 3 then goto·40
13 goto 2
Thanks again to anyone who can help. I have now used BASIC in years and it was always my favorite.
Pete
Comments
·· You can try this…Since x is an integer and not a string there’s no need to declare an array. X is declared as a byte…the DEBUGIN will get the input from the DEBUG window, although it could come from anywhere (you did not specify). The next line branches based on the value of X. You only need to trap if you might receive a value outside that range, in which the program will fall through. Also see the BRANCH instruction for another way to do this.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
2 input x$
10 If x = 1 then goto 20
11 if x = 2 then goto 30
12 if x = 3 then goto 40
13 goto 2
X VAR WORD
MAIN:
SERIN 16, 16468, [noparse][[/noparse]DEC X]
IF X = 1 THEN Do20
IF X = 2 THEN Do30
IF X = 3 THEN Do40
GOTO MAIN
Do20:
' do whatever
GOTO MAIN
Do30:
' do whatever
GOTO MAIN
Do40:
' Do whatever
GOTO MAIN
And Chris is correct:
ON X DoNothing, Do20, Do30, Do40
Would do almost the same thing...