Using Set node to declare a loop counter variable and incrementing it

Hey all, I’ve been looking into code node-free solutions to create a HTTP request retry loop with a counter variable that increments and breaks the loop once the retry limit number has been reached.

Strangely enough, I found that I was able to perform a += operation on a variable in another Set node earlier in the chain and use it as a counter.

The only source I was able to find describing a similar behavior is this post, but beyond this, I wasn’t able to find any official sources confirming whether this is a known behavior (feature) or a bug that could be patched in future versions. I honestly think it’s a pretty neat solution but would hate having to revise things in the future (would prefer to get things done in the best practice upfront). Any insight would be greatly appreciated!

  • n8n version: 1.122.2

Hello, I have the same requirement. Do you have any solution for this?