|
[Date Index]
[Thread Index]
[Author Index]
Re: Multiple operations in a "Do" expression
- To: mathgroup at smc.vnet.net
- Subject: [mg123230] Re: Multiple operations in a "Do" expression
- From: Dana DeLouis <dana01 at me.com>
- Date: Mon, 28 Nov 2011 05:52:44 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
> what would be the syntax to perform two or more operations with the counter value...
Hi. Just a simple example might be:
Module[
{a=2,k={" * "," = "},t,Str},
Do[
t=idx*a;
Str=ToString/@{idx,a,t};
Str= Riffle[Str,k];
Str=StringJoin[Str];
Print[Str],
{idx,0,3}]
]
0 * 2 = 0
1 * 2 = 2
2 * 2 = 4
3 * 2 = 6
= = = = = = = = = =
HTH
Dana DeLouis
Mac, Ver 8
= = = = = = = = = =
On Nov 26, 5:09 am, Mark <big.d... at att.net> wrote:
> 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
Prev by Date:
Re: How to solve or approximate a first order differential equation ?
Next by Date:
Plotting being aborted with RegionBoundary
Previous by thread:
Re: Multiple operations in a "Do" expression
Next by thread:
How to solve or approximate a first order differential equation ?
|