.select

The .select statement allows one of several values to be assigned to an assembler variable depending on an integer index. There is no limit to the number of values that can be selected from. If a value is missing (as may be the case with a macro argument that is expanded out of existance) then that value if selected will be equivalent to an empty string. The index starts at 0. All values including the index may be complex expressions. The .select statement provides a lookup or table dereferencing mechanism.
syntax:

        <var> .select <index>, <val0>, <val1>, <val2>, <valN>

e.g.

foo     .macro  arg1, arg2, arg3

var     .set    1

        .while  var < 3

var2    .select var, arg1, arg2, arg3

        .db     var2

var     .set    var+1

        .done

        .endm


        foo     "a", "b", "c"

        foo     "a", "b"
        foo     "a"
        foo