Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Multiple operations in a "Do" expression
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Mark

Posts: 18
Registered: 10/29/11
Multiple operations in a "Do" expression
Posted: Nov 26, 2011 4:39 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello community
I'm learning Mathematica. The expression below just performs one operation. For instructive purposes, what would be the syntax to perform two or more operations with the counter value of the "Do" expression below such as another calculation.

Thanks in advance.
Mark

Module[{a},
a=2;
Do[Print[idx," x ",a, " = ", idx*a],{idx,0,3}](*Multiply the loop-counter by the variable "a" here and print*)
]

0 x 2 = 0
1 x 2 = 2
2 x 2 = 4
3 x 2 = 6




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.