Jump to content

#ifdef


Recommended Posts

can I do ->

If $MODE = 1 Then
  While $S < 5
ElseIf $MODE = 2 Then
  While $S < 10
EndIf
    MsgBox(0, "..", "...")
Wend

in C++ there is #ifdef , #ifndef, #define etc for this, when you use that the compiler ignores that part of code, can this also be done in AutoIt, if yes, what functions

thx

Link to comment
Share on other sites

can I do ->

If $MODE = 1 Then
  While $S < 5
ElseIf $MODE = 2 Then
  While $S < 10
EndIf
    MsgBox(0, "..", "...")
Wend

in C++ there is #ifdef , #ifndef, #define etc for this, when you use that the compiler ignores that part of code, can this also be done in AutoIt, if yes, what functions

thx

<{POST_SNAPBACK}>

Nothing currently implented. Even in C/C++, this is usually considered poor form. It would be better to do this:

If $MODE = 1 Then
  While $S < 5
    MsgBox(0, "..", "...")
  Wend
ElseIf $MODE = 2 Then
  While $S < 10
    MsgBox(0, "..", "...")
  Wend
EndIf

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

Or, maybe decide the stopping index first, and then execute the while loop.  Something like this:

If $MODE = 1 Then
  $iStop = 5
ElseIf $MODE = 2 Then
  $iStop = 10
EndIf

While $S < $iStop
  MsgBox(0, "..", "...")
Wend

<{POST_SNAPBACK}>

Yup, this is better. You still need a way to change $S so that you can stop.

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

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