• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: "Next" in Repeat?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: "Next" in Repeat?
      • From: Steve Ivy <email@hidden>
References: 
 >"Next" in Repeat? (From: Steve Ivy <email@hidden>)

  • Prev by Date: Apple Data Detectors & 9.1
  • Next by Date: Re: Count of Tab characters
  • Previous by thread: "Next" in Repeat?
  • Next by thread: Re: "Next" in Repeat?
  • Index(es):
    • Date
    • Thread