• 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: Exiting a repeat loop if not false
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exiting a repeat loop if not false


  • Subject: Re: Exiting a repeat loop if not false
  • From: Bob Studer <email@hidden>
  • Date: Thu, 25 May 2006 18:38:00 -0700

On May 25, 2006, at 4:34 AM, Jay Louvion wrote:

set AllowExit to true
repeat
   set OrderNum to ""
    set OrderNum to text returned of (display dialog "Numéro de la commande (sans le \"LG\") ?" default answer "")
    try
       set OrderNum to (OrderNum as integer)
    on error
       set AllowExit to false
   end try
   if AllowExit is true then exit repeat
end
repeat

I think you might find this a little more elegant:

set OrderNum to ""
repeat while OrderNum is ""
set OrderNum to text returned of (display dialog "Numéro de la commande (sans le \"LG\") ?" default answer "")
try
set OrderNum to (OrderNum as integer)
on error
set OrderNum to ""
end try
end repeat

    -Bob

PGP: 0x5A969850
---------------------
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
                                   -Brian Kernighan


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Exiting a repeat loop if not false (From: Jay Louvion <email@hidden>)

  • Prev by Date: Re: whose clause with two conditions?
  • Next by Date: Re: whose clause with two conditions?
  • Previous by thread: Re: Exiting a repeat loop if not false
  • Next by thread: Re: Exiting a repeat loop if not false
  • Index(es):
    • Date
    • Thread