Jump to content

Goto / Sub Function In Autoit V3


Recommended Posts

You have to define a user function by Func myFunction () ... EndFunc

and just replace your Gosub by MyFunction().

If you have AutoIt V2 script you can try to convert with the "V2 to V3 converter" you find in the Extras folder.

There is a lot of new functions in V3 but the GOTO has gone for ever. replace by a structured language with If...then...else, While...wend, Do...Until, Func...EndFunc

Take a look at the doc :D

Link to comment
Share on other sites

  • 6 months later...

You have to define a user function by Func myFunction () ... EndFunc

and just replace your Gosub by MyFunction().

If you have AutoIt V2 script you can try to convert with the "V2 to V3 converter" you find in the Extras folder.

There is a lot of new functions in V3 but the GOTO has gone for ever. replace by a structured language with If...then...else, While...wend, Do...Until, Func...EndFunc

Take a look at the doc :)

<{POST_SNAPBACK}>

Docs are ok, but I'd rather look at the nurses. :)

OK, but on a more serious note: How is the removal of goto // gosub making it a "structured" language? calling subroutines would be much easier than a defined function... although they are more or less one and the same, just that for the Old Schoolers (myself included) are more used to the goto and gosub calls.

Would it have been that much of a pain to leave them in?

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Deadhorse topic. Very well argued on both sides pretty well in the past. All I will say is that you can have spagetti code in both, and clean nice code as well, but learn to use UDFs and loops and you will never go back.

Took me a long time to give up my oldschool GOTOs, and I still use them in many other languages. I tend not to put a lot (or any) comments in my own scripts(unlike I do here) so when I go back and look at code I did 6 mos ago, it can be hard to debug. Having this structure helps a lot. It also helps me interpret other folks scriblings. :)

"Functions Rule!" :)

not my quote, but I like it.

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...