Printing items in an array.
Jan 25, 2015 18:39:08 GMT -5
Post by daveylibra on Jan 25, 2015 18:39:08 GMT -5
Hi, I am just trying to write a very simple program in RunBasic, but as I am a beginner I am struggling.
I am trying to create an array of numbers, depending on another number I input. So far I have
DIM P(100)
P(1)=1
P(2)=2
P(3)=2
FOR X=4 TO 100
INPUT N
I then want to do this:
If N is one of a certain set of numbers, lets say 1 for simplicity, the next item in the array - P(X)- keeps the value of the previous one.
If N is one of another set of numbers, lets say 0, I want to 'cross off' (or make 0) the previous value in the list, and also the first value in the list that is not already crossed off. I then make P(X) equal to the next value in the list, plus 1.
If all values are crossed off, END.
But there must be something wrong with my syntax, as whatever I do, if I PRINT P(X) I get
Error: #asIfnumber
any advice on how to write the progression would be much appreciated.