• 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: Go To Commands (AppleScript)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Go To Commands (AppleScript)


  • Subject: Re: Go To Commands (AppleScript)
  • From: Andy Wylie <email@hidden>
  • Date: Sat, 20 Jul 2002 03:23:52 +1200

on 19/7/02 10:54 AM +1200: Emmanuel wrote:

> At 7:20 PM +0200 18/7/02, Dave DeLong wrote:
>>
>> The game I'm planning to write is a computer version of the calculator game
>> "Drugwars." This game, when programmed on a calculator, absolutely needs
>> gotos. If not, the entire thing would be an incredibly complex if...then
>> statement. Gotos aren't necessarily bad programming if they're managed
>> correctly and written in a way that optimizes performance. Jumping from end
>> to end of code, however, is stupid. I just need jumps for certain areas.
>
> As I understand, AppleScript was designed as a very procedural language. We
> must chop our code into numerous small routines, in order to compensate for
> the weak branching possibilites of the language. In order words, "return"
> is used instead of "next repeat", "goto" etc.
>
> For instance, instead of:
>
> ----------------
> repeat for ...
> blah blah
> if something then next repeat
> blah blah
> end repeat
> ----------------
>
> you would write:
>
> ----------------
> on OneLoop()
> blah blah
> if something then return
> blah blah
> end OneLoop
>
> repeat for ...
> OneLoop()
> end repeat
> ----------------
>
> Now, I would be curious to know whether the procedural suggestion would
> work in your case.
>

Is there anything wrong with having the handler call itself?

on OneLoop()
if something then OneLoop()
blah blah
end OneLoop

_____________________________ Andy
_______________________________________________
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: 
 >RE: Go To Commands (AppleScript) (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: Passing *possible* variables to a handler
  • Next by Date: USB Device Detection and Alarm
  • Previous by thread: RE: Go To Commands (AppleScript)
  • Next by thread: Re: Go To Commands (AppleScript)
  • Index(es):
    • Date
    • Thread