# Math Help - Mathematica: Lists

1. ## Mathematica: Lists

Hi all

I have the following code:

For[i = 0, i < 98, i++,
q = i*100;
For[j = 102 + q, j < 2*100 + q, j++,
Print[j]]]

The output of this loop I wish to put in a list. Can you guys give me a hint to do that?

Sincerely,
Niles.

2. Ok, I just used Create Lists - Wolfram Mathematica 7 Documentation

Mathematica is well-documented.

3. You can always define a help variable

$res=\{ \}$

and replace $Print[j]$ with $AppendTo[res,j]$. At the end, just ask the program to return $res$.

4. That solution was much nicer than mine; thanks. Do you know if it is possible to perform multiple tasks in an if-condition? I.e.

If[2>1,
Do this
Also do this
Also do this and this,
Else only do this
]

?

5. Of course:

If [ Condition, Action 1; Action 2; Actions 3; ... ; Action n].

Just separate the tasks by ; and keep the , for telling the If what to do should the condition fail to be true.

6. Thanks, I appreciate it.