First page Back Continue Last page Overview Text
This program searches a list (starting at address DAT) for a match to the value stored in location VAR. If a number in the list is equal to the value stored in VAR the loop terminates. If the end of the list is reached (it has a zero terminator), the program also terminates. This code can be used to look up values (such as in reading a keypad) and either return an index into the list when a match is found or return a value such as -1 if no match is found. The program structure is a while with a compound test.