Sign in to follow this  
Followers 0
apsync

#ifdef

5 posts in this topic

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

Share this post


Link to post
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...

Share this post


Link to post
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

Share this post


Link to post
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...

Share this post


Link to post
Share on other sites

allright, i know enough, thanks

Share this post


Link to post
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
Sign in to follow this  
Followers 0