Is there a way to output table cells in a for loop? #830
Answered
by
johannes-wolf
cds-internationalist
asked this question in
Q&A
-
Maybe this is trivial, but having a hard time finding details in the documentation. Table cells (among other structures) are separated by commas in code - is there a way to output table cells in a for loop? My feeble attempts have so far just resulted in a error or outputting commas to the text rather than code. |
Beta Was this translation helpful? Give feedback.
Answered by
johannes-wolf
Apr 16, 2023
Replies: 1 comment
-
You can use the spread operator #table(columns: 2,
..(for a in range(1, 11) { ([#a], ) }))
/* ^-- Note the trailing comma to create an array with one item */ All arrays returned by |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
cds-internationalist
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use the spread operator
..
like this:All arrays returned by
for
are joined into one single array, which then is spread using..
.