Your arrays and the IF block need fixing.

by Solitaire (Login Solitaire1)
S

Your arrays begin with 0, not with 1. So when you use a FOR loop starting with 1, it skips over the first index (which is 0) in the array. You could declare your arrays starting with 1.
For example: DIM myarray(1 TO 10) AS STRING

Also, you need to place more of the code INSIDE an IF block, as I had posted in the sample. NOT this way with a single statement: (The 2 instructions after that statement will execute no matter what. They should only execute if the condition is true.)

-------------------------------------
DO
FOUND = 0
FOR R = 1 TO 10
FOR S = 1 TO 4
IF SEAT(R, S) = "" THEN SEAT(R, S) = WLIST(FOUND)  'single statement
FOUND = FOUND + 1
IF FOUND > 10 THEN EXIT DO
NEXT S
NEXT R
LOOP WHILE FOUND <= 10
-------------------------------------

But this way, with a block:

--------------------------------------
DO
FOUND = 0
FOR R = 1 TO 10
FOR S = 1 TO 4
IF SEAT(R, S) = "" THEN
   SEAT(R, S) = WLIST(FOUND)
   FOUND = FOUND + 1
   IF FOUND > 10 THEN EXIT DO
END IF
NEXT S
NEXT R
LOOP WHILE FOUND <= 10

Posted on May 20, 2012, 10:04 PM

Respond to this message   

Return to Index


Response TitleAuthor and Date
re:your arrays are..Matt on May 22
 Re: CorrectionMATT on May 22
 Sub can call other subs.Solitaire on May 22
  re: Sub can call..Matt on May 28
I'm surprised you didn't mention LBOUND and UBOUND.a on May 22