Re: for loop

From: Alexandre Ratchov <alex_at_caoua.org>
Date: Mon Dec 19 2016 - 15:24:23 CET
On Sat, Dec 17, 2016 at 11:36:36PM -0800, Richard Goulstone wrote:
> Hello. Is there a way to make a for-loop of x number of iterations set by the value of a variable?
> 
> Initially I tried C type syntax normal for loop, then I tried
> 
> for i in {0..10} {
>   print “foo”;
> }
> 
> but that iterates just once.

hi,

above can iterate on lists only; there's no way to iterate over
integer ranges (or to create infinite loops), mainly because they
can't be interrupted yet.  For "small" integer ranges I do:

for i in {0 1 2 3 4 5 6 7 8 9 10} {
	print "foo";
}

hth

-- Alexandre
Received on Mon, 19 Dec 2016 15:24:23 +0100

This archive was generated by hypermail 2.1.8 : Wed Nov 08 2017 - 16:32:30 CET