• 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: Simple if .. else .. then statment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple if .. else .. then statment


  • Subject: Re: Simple if .. else .. then statment
  • From: Bill White <email@hidden>
  • Date: Sat, 29 May 2004 12:22:01 -0400

On 5/29/04 11:11 AM, Rick Davis <email@hidden> wrote:

> How do I tell my script to look at a list of items and perform a task if a
> condition is met and skip to the next item in the list if the condition is not
> met?

Rick,

Here's a simple example:

set theList to {1, 2, 3, "x", "y", 4}

repeat with i from 1 to count theList

set thisItem to item i of theList

if class of thisItem is integer then

-- do something with the item, such as...
beep 3

else

-- do something else...
display dialog thisItem

end if

end repeat

Is that what you're after?

Bill
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Simple if .. else .. then statment (From: Rick Davis <email@hidden>)

  • Prev by Date: Re: Simple if .. else .. then statment
  • Next by Date: Re: Simple if .. else .. then statement
  • Previous by thread: Re: Simple if .. else .. then statment
  • Next by thread: Re: Simple if .. else .. then statement
  • Index(es):
    • Date
    • Thread