Jump to content

Sub-dividing Code


 Share

Recommended Posts

Hi,

In the past I have subdivided code in my script.

That is, I have had my entire code divided into 'titled' sections so that I could simply 'call' a particular section if conditions are met.

My problem now is that I've not written much for a while and I can't remember the special character or method required when you 'title' a section of code.

I am not talking about commenting which uses the semicolon.

Thanks in advance.

Link to comment
Share on other sites

No I'm not talking about functions, although I have achieved what I needed to do using the function syntax. I'm still curious though of what the syntax was for my original question. I think the 'sub sections' of code are identified with Labels? You would then call the corresponding Label in your code to jump to different sections.

Thanks for your help.

Link to comment
Share on other sites

Hmm, perhaps you are thinking of DOS batch script labels

if %var% = 1 goto sub1
if %var% = 2 goto sub2
:sub1
echo Var was equal to 1
goto end
:sub2
echo Var was equal to 2
goto end

:end
echo this is the end
but there is nothing like that in AutoIt. It's a crappy way to do things in any case. You're much better off with functions and loops.

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

Hmm, perhaps you are thinking of DOS batch script labels

if %var% = 1 goto sub1
if %var% = 2 goto sub2
:sub1
echo Var was equal to 1
goto end
:sub2
echo Var was equal to 2
goto end

:end
echo this is the end
but there is nothing like that in AutoIt. It's a crappy way to do things in any case. You're much better off with functions and loops.
@ lod3n:

Yes, I think you may be right. That was what I was thinking of. I have used a couple of functions anyway and they do seem to be quite simple to set up.

Thanks for your help.

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...