Message Boards Message Boards

0
|
3989 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

using for loop in mathematica.

Posted 10 years ago

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]]

POSTED BY: esi fn
2 Replies

See my comment to your other question:

http://community.wolfram.com/groups/-/m/t/395069

POSTED BY: David Reiss
Posted 10 years ago

i++ increments i by 1 each time.

increment documentation

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

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract