The code
Table[i, {i, 5}]
produces the output
{1, 2, 3, 4, 5}
whereas the code
x = {i, 5};
Table[i, x];
produces an error, namely
Table::itform: Argument x at position 2 does not have the correct form for an iterator.
Why, and how do I fix this?
Table@@{i,x}
. If you check theAttributes
ofTable
you will notice that has theHoldAll
attribute so thex
will not be evaluated. $\endgroup$Table[i,x//Evaluate]
but I find it a little ugly :P $\endgroup$With[{x = {i, 5}}, Table[i, x]]
. $\endgroup$Table
as an example problem for the actual underlying question. $\endgroup$