Help me please, how I can write two action in the body of the cycle "for"?
For example, if I need to write Print[] and Append[] at each iteration.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityHelp me please, how I can write two action in the body of the cycle "for"?
For example, if I need to write Print[] and Append[] at each iteration.
You can use CompoundExpression (;)
(expressions separated by ;
) in any argument of For
:
For[i = 0; a = {}, i < 4, i++, Print[i]; AppendTo[a, i]]
Print[...];Append[...]
? (See CompoundExpression in the docs.) $\endgroup$ – kglr Jun 9 '19 at 22:51