# using for loop in mathematica.

**URL:** <https://community.wolfram.com/t/using-for-loop-in-mathematica/4094>\
**Category:** Questions\
**Tags:** mathematica\
**Created:** [November 23, 2014, 6:05pm UTC](https://community.wolfram.com/t/using-for-loop-in-mathematica/4094 "2014-11-23T18:05:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehsanfarsinia](https://avatars.discourse-cdn.com/v4/letter/e/d07c76/32.png) [@ehsanfarsinia](https://community.wolfram.com/u/ehsanfarsinia)\
**Post date:** [November 23, 2014, 6:05pm UTC](https://community.wolfram.com/t/using-for-loop-in-mathematica/4094/1 "2014-11-23T18:05:43Z")

</div>

hi i want use for loop in mathematica but i do not know what is the role of i++? i think this loop is equal to  
for i=1:4  
print(i)  
end  
in matlab. Do I understand correctly?  
For[i = 0, i \< 4, i++, Print[i]]

---

<div class="post-metadata">

**Author:** ![bsimpson141421356](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bsimpson141421356](https://community.wolfram.com/u/bsimpson141421356)\
**Post date:** [November 23, 2014, 6:31pm UTC](https://community.wolfram.com/t/using-for-loop-in-mathematica/4094/2 "2014-11-23T18:31:19Z")

</div>

i++ increments i by 1 each time.

[increment documentation](http://reference.wolfram.com/language/ref/Increment.html)

This is the same as For[i = 0, i \< 4, i=i+1, Print[i]]

For[i = 0, i \< 4, i=i+1/4, Print[i]] increments i by 1/4 each time, similar to Matlab for i=1:1/4:4 print(i) end

---

<div class="post-metadata">

**Author:** ![dreiss](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/dreiss/32/29094_2.png) [@dreiss](https://community.wolfram.com/u/dreiss)\
**Post date:** [November 23, 2014, 7:06pm UTC](https://community.wolfram.com/t/using-for-loop-in-mathematica/4094/3 "2014-11-23T19:06:43Z")

</div>

See my comment to your other question:

[http://community.wolfram.com/groups/-/m/t/395069](http://community.wolfram.com/groups/-/m/t/395069)
