Strange data manipulation in code block

I encountered a problem while trying to do some looping in the code block and made this simple code blocks to study to study the problem but I can’t figure out why design script is giving me meaningless results. Help is much appreciated.

in the left I have a list of 4 items (a) and used a block to calculate the length (b),

in the top I used a function (OmidCounter01) to do the same thing however the result is funny (a list of 4 members counting 1 in each)

in the bottom i used a for loop with similar syntax (OmidCounter02) to the above and got the right answer (4)

Why is the top one giving me funny results ?!

Have a look at this great blog post by Colin for more information:

http://dynamobim.org/what-does-var-mean/

Thanks a lot for your help. Very useful link.

Best,
Omid