Still a Bit Confused
peteraltman
Posts: 4
This forum is great. However, I used· to be real good in GW BASIC I really feel· like a fool asking these questions. So maybe· you guys can help.
I was instructed· by the forum to interpret GW BASIC to Parallax Basic as follows:
GW BASIC -Verison
10 input a
20 if a=1 then 30
21 if a= 2 then 40
22 if a= 3 then 50
25 goto 10
HERE IS WHERE MY PROBLEMS LYE: I was intructed to use labels. Can someone explain how I would use (gwbasic· format ) 20 if a = 1 then 30: Parallax, how would I write the goto· LABEL to replace the line # 30?
30a=a+32[noparse]:p[/noparse]rint a:goto 60
40a=a+64[noparse]:p[/noparse]rint a:goto 60
50:a=a+128: print a:goto 60
Thanks Again and if you r in NYC. Lunch is on me.
Pete
I was instructed· by the forum to interpret GW BASIC to Parallax Basic as follows:
GW BASIC -Verison
10 input a
20 if a=1 then 30
21 if a= 2 then 40
22 if a= 3 then 50
25 goto 10
HERE IS WHERE MY PROBLEMS LYE: I was intructed to use labels. Can someone explain how I would use (gwbasic· format ) 20 if a = 1 then 30: Parallax, how would I write the goto· LABEL to replace the line # 30?
30a=a+32[noparse]:p[/noparse]rint a:goto 60
40a=a+64[noparse]:p[/noparse]rint a:goto 60
50:a=a+128: print a:goto 60
Thanks Again and if you r in NYC. Lunch is on me.
Pete
Comments
start:
if a = 1 then goto label1 (Look in the manual for the exact syntax, I have to every time.)
if a = 2 then goto label2 (don't remember if you need the goto or not. The manual knows)
....
label1:
do this
label2:
do that
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
1) There are no numeric labels and lines are not numbered
2) Labels are typical program names, they start with a letter and can consist of letters and digits
3) You can translate something like GW BASIC to PBasic, but there are simpler control statements in PBasic that can make a lot of labels unnecessary. Your example would be:
A more compact version would be:
http://forums.parallax.com/showthread.php?p=637548
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support