My question is similar to that discussed in How to programmatically make tabular rows using `\whiledo` ?. The difference is that I want to produce columns rather than rows with using \whiledo. Basically I have the code:
\documentclass{article}
\usepackage{tabularx}
\newcounter{index}
\setcounter{index}{3}
\newcommand{\Line}{& 1 & 2 & 3}
\begin{document}
\begin{tabularx}{0.9\textwidth}{|r|*{\value{index}}{X|}}
\hline
Some text \Line \\
\hline
\end{tabularx}
\end{document}
My task is to redefine the command \Line such that it would have one argument, value of the counter index. It should produce columns with the content 1, 2, 3, ..., n. Here n is value of the counter index.
I am filling that there exists a solution with \whiledo but still my attempts to find it are unsuccessful. I would be appreciate for any help.
