• 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: Jumping to next iteration in loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Jumping to next iteration in loop


  • Subject: Re: Jumping to next iteration in loop
  • From: Paul Berkowitz <email@hidden>
  • Date: Sat, 13 Oct 2001 09:42:43 -0700

And if ever that method becomes too cumbersome, which can happen when you
are in the middle of deeply nested if/then blocks, for example. then this
technique works well:

repeat with n from 1 to 10
repeat 1 times

if n mod 3 is not 0 then
exit repeat -- the '1 times repeat', goes on to next n
end if

--lots and lots of other stuff

end repeat -- the '1 times' repeat
end repeat

--
Paul Berkowitz

> From: Paul Hague <email@hidden>
> Date: Sat, 13 Oct 2001 17:06:56 +0200
> To: Timothy Bates <email@hidden>, AppleScriptUsers List
> <email@hidden>
> Subject: Re: Jumping to next iteration in loop
>
> Many thanks, Timothy.
>
> Obvious really now you point it out.
>
> Cheers
> Paul
>
>> From: Timothy Bates <email@hidden>
>> Date: Sun, 14 Oct 2001 00:09:15 +1000
>> To: Paul Hague <email@hidden>, AppleScriptUsers List
>> <email@hidden>
>> Subject: Re: Jumping to next iteration in loop
>>
>> On 14/10/01 12:02 AM, "Paul Hague" <email@hidden> wrote:
>>> I need a statement equivalent to the 'continue' statement in C.
>>> how would experienced programmers work around this apparent
>>> limitation in the language?
>>
>> No idea :-) But I would just wrap the bit you want to skip in an if
>> statement:
>>
>> repeat with n from 1 to 10
>> if n mod 3 is not 0 then
>> --like-continue
>> else
>> display dialog n
>> end if
>> end repeat
>> _______________________________________________
>> applescript-users mailing list
>> email@hidden
>> http://www.lists.apple.com/mailman/listinfo/applescript-users
> _______________________________________________
> applescript-users mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/applescript-users


References: 
 >Re: Jumping to next iteration in loop (From: Paul Hague <email@hidden>)

  • Prev by Date: Re: Invisible scripts in Script menu
  • Next by Date: Re: Invisible scripts in Script menu
  • Previous by thread: Re: Jumping to next iteration in loop
  • Next by thread: ANNOUNCEL Sample XML-RPC server for Mac OS X, Windows, etc.
  • Index(es):
    • Date
    • Thread