Message Boards Message Boards


using for loop in mathematica.

Posted 9 years ago
2 Replies
0 Total Likes

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:

POSTED BY: David Reiss
Posted 9 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
or Discard

Group Abstract Group Abstract