Jump to content

If And


Recommended Posts

I am running several if statements, and I need to test if they are all true. See Example Below

If FileExists("C:\1") 
    And
    If FileExists("C:\2")
    And
    If FileExists("C:\3")
    Then

Is this possible or do I have to put then inside each other

If FileExists("C:\1") Then
       If FileExists("C:\2") Then
          If FileExists("C:\3") Then
             Then

The first example is so much easier to manage problems with is there any way to make it work.

Link to comment
Share on other sites

Local $a = 1, $b = 1, $c = 1
If $a And $b And $c Then
    ConsoleWrite("all true" & @CRLF)
Else
    ConsoleWrite(">= 1 false" & @CRLF)
EndIf

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

  • Developers

Nevermind I've worked it out - it all has to be on one line

no it doesn't but you will have to use the continuation character :blink:

If FileExists("C:\1") _
    And FileExists("C:\2") _
    And FileExists("C:\3") Then

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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