How to change variable value inside template {{#each}} loop?

I am trying to generate table of given number of columns with templates from a list (list of my tags, to be precise, because I have plenty of them and I think that listing them in a table would be far better than in a list or a paragraph).

The idea is to have a counter, generate a table row cell | by cell | and insert cell and EOL whenever the counter modulo the desired number of columns is equal to zero. How to do it in templates?

I tried {{#let @i = @i + 1}} within an {{#each}} loop but without any success. How to change the value of a scoped variable within the scope? If it’s not possible what “trick” can be used to let the inner-most {{#if (@i%10) = 0}}...{{else}}...{{/if}} work?

The question can be simplified as much as to “How to change variable values inside {{#each}} loops?”