 |
|
 |
|
Next: So, does anyone use OpenDNS to bypass the payment..
|
| Author |
Message |
External

Since: Feb 02, 2008 Posts: 4
|
(Msg. 1) Posted: Sun Nov 09, 2008 2:53 pm
Post subject: why does a "repeat with" loop reset the counter? Archived from groups: alt>comp>lang>applescript (more info?)
|
|
|
When the following script is run, why does the display dialog command
display 51, 52, 53, etc? The counter i is reset when the repeat is
incremented, completely ignoring the new value given to i. I would
have thought that the values displayed would be 51 then 102 and the
loop would end. What is it that I don't understand with this simple
code? Thanks.
repeat with i from 1 to 100
set i to i + 50
display dialog i
end repeat >> Stay informed about: why does a ""repeat with"" loop reset the counter? |
|
| Back to top |
|
 |  |
External

Since: Feb 02, 2008 Posts: 4
|
(Msg. 2) Posted: Sun Nov 09, 2008 3:28 pm
Post subject: Re: why does a "repeat with" loop reset the counter? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
| I actually need the loop to increment by 4,4,2,4,3,4,2,4,4,2 instead
of 1,1,1,1,1,1,1. So I was going to add the differing increments at
the end of the loop using a formula. I guess I need to make a list of
increment numbers and move through the list. It was just going to be
pretty long so I wanted to increment it programatically. How would
you handle this situation?
|
>> Stay informed about: why does a ""repeat with"" loop reset the counter? |
|
| Back to top |
|
 |  |
External

Since: Jul 15, 2003 Posts: 4218
|
(Msg. 3) Posted: Sun Nov 09, 2008 4:20 pm
Post subject: Re: why does a "repeat with" loop reset the counter? [Login to view extended thread Info.] Imported from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Jul 15, 2003 Posts: 4218
|
(Msg. 4) Posted: Sun Nov 09, 2008 5:08 pm
Post subject: Re: why does a "repeat with" loop reset the counter? [Login to view extended thread Info.] Imported from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Nov 12, 2003 Posts: 247
|
(Msg. 5) Posted: Sun Nov 09, 2008 7:25 pm
Post subject: Re: why does a "repeat with" loop reset the counter? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Nov 12, 2003 Posts: 247
|
(Msg. 6) Posted: Sun Nov 09, 2008 7:25 pm
Post subject: Re: why does a "repeat with" loop reset the counter? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article
,
John Mosby wrote:
> I actually need the loop to increment by 4,4,2,4,3,4,2,4,4,2 instead
> of 1,1,1,1,1,1,1. So I was going to add the differing increments at
> the end of the loop using a formula. I guess I need to make a list of
> increment numbers and move through the list. It was just going to be
> pretty long so I wanted to increment it programatically. How would
> you handle this situation?
You can increment it programatically, just use a separate variable for
the loop counter
set a to 1
repeat with i from 1 to 10
set a to a + ...
end repeat
Patrick
--
Patrick Stadelmann >> Stay informed about: why does a ""repeat with"" loop reset the counter? |
|
| Back to top |
|
 |  |
External

Since: Mar 30, 2004 Posts: 22
|
(Msg. 7) Posted: Mon Nov 10, 2008 8:26 am
Post subject: Re: why does a "repeat with" loop reset the counter? [Login to view extended thread Info.] Imported from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|