|
That is definitely a task better handled by two nested loops - one for the table rows and one inside it for the cells in the row.
There is no recursive solution that would map in any meaningful way to the structure of the data so while it would be possible to write a less efficient recursive version of the code it would not only use a lot more memory and run slower - it would also be much harder to maintain.
You should only use recursion where it maps to the task in a meaningful way.
|