@smititelu - that note from the docs sounds ok for me (maybe because I wrote it, although I am not sure I did). Practically wants to say that assign explicitly a value before using it, not to get the value set a while ago in another SIP message processing context.
If you do:
``` request_route { ... while ($var(i) < 100) { ... $var(i) = $var(i) + 1; } ... } ```
The while loop gets inside once because $var(i) is 0 first time, but then remains set to 100 for all next requests. Therefore set it to the value you want before using it:
``` request_route { ... $var(i) = 0; while ($var(i) < 100) { ... $var(i) = $var(i) + 1; } ... } ```
Feel free to change the statement in the docs, if you consider more clarifications there, but I don't see any benefit in storing an extra int field in the internal var structure.
Maybe $vn() offers better the kind of variable you need. It is like $var() but can have $null value (state).