Repeat with...Repeat for...

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

Post Reply
RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Repeat with...Repeat for...

Post by RossG » Thu May 19, 2016 11:35 pm

Is it necessary to have both "repeat with..." and
"repeat for..."?

Since the next word is either "x" or "each" it shouldn't
be too difficult to make them both "for", the usual
word in other languages.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Repeat with...Repeat for...

Post by dave.kilroy » Fri May 20, 2016 11:33 am

Yes

They do different things, both of which are useful - check out 'repeat' in the dictionary

Regards

Dave
"...this is not the code you are looking for..."

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Repeat with...Repeat for...

Post by dunbarx » Fri May 20, 2016 1:04 pm

"Repeat with", though slower than any other type, is utterly essential, since it manages a repeat index internally. All the others either test a condition, contain no index or other constrant at all, or churn through successive chunks of a container.

One might make a case that "repeat while" and "repeat until" are different aspects of the same conceptual process, but each is useful in its own right if for no other reason than either construction might make more sense depending on how one sets up the loop.

Craig Newman

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Repeat with...Repeat for...

Post by Mikey » Fri May 20, 2016 2:04 pm

Sometimes I miss the Pascal way of handling Repeat and While, but I do like the different flavors we get with LC, especially the way that repeat for is optimized to increase speed.

Post Reply