Click here for important information about

I have a question about arrays in gwbasic.

January 26, 2011 at 15:31:26
Specs: Windows 7
40 FOR I = 1 TO 10
50 READ A(I)
70 DATA 1,1,2,2,3,3,4,4,5,5
I'm writing a word game for my grandchildren and I to play. At A(1) on a loss how can I get it to go to A(2) on another loss go to A(3) and on a win go back from A(3) to A(2) and another win go back to A(1) a win on A(1) and stay on A(1) as long as it wins? Any help would be greatly appreciated! I know it's an old obselete language but I don't need fancy windows stuff or communications. I just want to write programs for myself and I can understand gwbasic a little.
Or if anyone wants to answer a few questions privately I'll give you my email address.

See More: I have a question about arrays in gwbasic.

January 26, 2011 at 16:31:18
This is nostalgic, reminding me of programming in 1979-80 as a teenager. Try something like the following. I don't know if it will work since it's been such a long time. Replace the words in italics with whatever you want the game to do.

100 N = 1
110 X = A(N)
120 [play]
130 IF [loss] THEN N = N + 1 ELSE N = N - 1
140 IF N = 0 THEN N = 1
150 GOTO 110

Report •

January 26, 2011 at 17:28:08
Thanks klint I really appreciate it. Looks like it might work. I'll try it and see.
Thanks again I've been banging my head against the wall trying to figure it out. But I couldn't find much about arrays other than how to put string stuff in them and retrieve it, not how to work with numeric data in the arrays.

Report •
Related Solutions

Ask Question