Aye, that would work, but as I mentioned in the other post, something like this: FOR x = 1 TO 50 IF UCASE$(states$(x)) = UCASE$(state$) THEN ok = 1 found = x EXIT FOR END IF NEXT x IF ok = 1 THEN PRINT state$; " was found at index "; x ELSE PRINT state$; " was not found" END IF could be also be written as something like this: FOR x = 1 TO 50 IF UCASE$(states$(x)) = UCASE$(state$) THEN PRINT state$; " was found at index "; x EXIT FOR END IF NEXT x IF x = 51 THEN PRINT state$; " was not found" END IF because x will be 51 if and only if EXIT FOR was not executed. The NEXT x increments x, then checks to see if x <= 50. When x is 50, NEXT x turns it to 51, then exits the loop. However, if a match had been found, EXIT FOR would exit the loop before x becomes 51. Regards, Michael |
| Response Title | Author and Date |
| Good shortcut. Another example using duplicate data: | Solitaire on May 13 |
| going a bit off topic... | on May 13 |
| Yes, in VB.NET: | Solitaire on May 13 |