I’ve adapted this code from the guide on tables, and I’m confused how it works.
#table(
columns: 3,
stroke: (x, _) => (
left: if x == 0 {1pt} else {0pt},
right: 1pt,
),
[1],[2],[3],
)
![]()
I don’t understand how the else clause from the left stroke command can change how the right stroke command behaves. Shouldn’t right: 1pt always put a stroke on the right of every cell regardless of what was written before it?
Also, if {0pt} is the default stroke on all sides when using functions (as shown with top and bottom not defined here), why does else {0pt} change anything? Else is always 0pt!
This is the behavior I expected from the first code snippet.
#table(
columns: 3,
stroke: (x, _) => (
left: if x == 0 {1pt},
right: 1pt,
),
[1],[2],[3],
)
![]()
And this is how I would naively achieve the first result.
(Although, it does require hard coding the number of columns, which the first way avoids.)
#table(
columns: 3,
stroke: (x, _) => (
left: if x == 0 {1pt},
right: if x == 2 {1pt},
),
[1],[2],[3],
)
![]()
Please explain how and why the stroke rules work this way.


