Inline tables and variables - bug or feature?

In an inline table, if you set variables in any of the options, the settings in later options overwrite settings in earlier options, no matter which option is chosen. This created some unexpected results until I realized what was going on.

In the example below, the variable s always acquires the value "second", even if the first option is chosen.

Table: Example
[|option 1{s=="first"}|option 2{s=="second"}] s={s}&
\n[|table 1[@s==Table1]|table 2[@s==Table2]] s={s}

Table: table1

Table: table2

The workaround is to avoid inline tables when you'll be setting variables. If you turn the inline tables above into regular tables, the variable s winds up as either "first" or "second" according to the chosen table entry.

Is this an intended feature, or a bug? Apparently, IPP runs every option in an inline table, including variable assignments, before it picks one of the options. In a regular table, it runs only the chosen option.

Leave a Comment