[GAP Forum] Putting variables in strings

Alexander Konovalov alexk at mcs.st-andrews.ac.uk
Fri Nov 16 12:06:40 GMT 2012


Hello Frederic,

Try this:

PrintTo( Concatenation( "outputfile", String(i), ".txt" ), i^3);

Hope this helps!
Alexander


On 16 Nov 2012, at 12:01, Frederic Vanhove wrote:

> Hello
> 
> this is probably a very basic thing but I struggled to find the proper commands.
> I would like to have GAP write output to several files, the names of which are automatically generated.
> 
> So I would like to have something like this:
> 
> for i in [1..10] do
> PrintTo("outputfile"+i+".txt", i^3);
> od;
> 
> Essentiallly, I just have to find the right way to get the proper string.
> How can I do this?
> 
> Thanks,
> Frédéric
> 
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum


--
Dr. Alexander Konovalov               School of Computer Science
& Centre for Interdisciplinary Research in Computational Algebra
University of St Andrews                 Tel +44/0 (1334) 461633
http://www.cs.st-andrews.ac.uk/~alexk    Fax +44/0 (1334) 463278
The University of St Andrews is a charity registered in Scotland:No.SC013532










More information about the Forum mailing list