• 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: If Statements
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: If Statements


  • Subject: Re: If Statements
  • From: Ed Stockly <email@hidden>
  • Date: Thu, 11 Sep 2008 09:02:03 -0700


I have a If statement that checks users user name. Teachers use first initial and last name and students go by a number. So right now my Else if looks like this:

If (username > 1 and username <10)
    do this
Else if (username > 11 and username < 20)
    do this other thing
Else
    do this third thing

End it

 One option:

try
If (username > 1 and username <10)
    do this
Else if (username > 11 and username < 20)
    do this other thing
Else
    do this third thing

End if

on error
    do the string thing
end try

another option:

if class of userName is in {"Text", "string"} then
    do the string thing
else If (username > 1 and username <10)
    do this
Else if (username > 11 and username < 20)
    do this other thing
Else
    do this third thing

End if

HTH,

ES
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: If Statements
      • From: Tim Mansour <email@hidden>
References: 
 >If Statements (From: William J Sisti <email@hidden>)

  • Prev by Date: Re: add xml element or attribute to story
  • Next by Date: Excel issues
  • Previous by thread: Re: If Statements
  • Next by thread: Re: If Statements
  • Index(es):
    • Date
    • Thread