LOOKDOWN Target, Value0, {Value1, Value2, ...} Variable

Function
Compare Target value to a list of values and store the index number of the first value that matches into ByteVar. If no value in the list matches, Variable is left unaffected.

Explanation
LOOKDOWN works like the index in a book. In an index, you search for a topic and get the page number. LOOKDOWN searches for a target value in a list, and stores the index number of the first match in a variable. For example:

Do_Cmd:
  DO
    SERIN Sio, Baud, cmd                        ' wait for command input
    LOOKDOWN cmd, "F", "B", "S", cmd            ' compare against valid commands
  LOOP UNTIL cmd < 3                            ' wait until valid
  BRANCH cmd, Forward, Backward, Stop_Bot       ' execute valid command

Related instruction: LOOKUP