Create a table with results coming from "While" command

Hello,

I would like to store the results computed in a “while” loop in on unique Table with one unique TableHeadings. For now, I’m able to print the result at each stage and hence the Table Headings is reeted each time. I’m sure that there is a more suitable solution.
Thank you!

My code:

While [R[t] >= 650 && t <= 300,
 .........
.......... 
 dataset = 
  TableForm[
   ptsF = Table[{t, R[t], W[t], G0[t], GC0[t], GLT[t], GP[t]}, {t, t, 
      t}], TableHeadings -> {None, {"t", "Ressources", "Extraction", 
      "Gain instantané", "Gain instantané cumulé", "Gain infini LT", 
      "Gain partie"}}]; Print[dataset];
 t++]

Maybe you could use Sow[] to collect the un-formatted results inside the While and then use Reap[] to get the collected values.

Hi Marion,

You could also use the TableWhile function from the Wolfram Function Repository.