Re: "Next" in Repeat?
Re: "Next" in Repeat?
- Subject: Re: "Next" in Repeat?
- From: JollyRoger <email@hidden>
- Date: Tue, 23 Jan 2001 09:59:43 -0600
on 1/23/2001 9:26 AM, Steve Ivy at email@hidden wrote:
>
I'm still kinda new to AppleScript - is there a way to break out of the
>
current loop in a repeat statement and skip to the next one?
>
>
Something like:
>
>
repeat with i in {1,2,3}
>
if i is "2"
>
next repeat
>
else
>
log (i)
>
end if
>
end repeat
Why not just:
repeat with i in {1,2,3}
if i is not "2"
log (i)
end if
end repeat
Also, you should be aware that since "is" and "is not" take into account the
variable type, {1,2,3} is a list of /numbers/, and you are testing for "2"
which is /text/, the if statement will fail. If you instead use:
if i "2" then -- is an option =
-or-
if not i = "2" then
...then the statement will do what you want.
HTH
JR