Jump to content
Sign in to follow this  

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") 
    If FileExists("C:\2")
    If FileExists("C:\3")

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

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

Share this post

Link to post
Share on other sites

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

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

Share this post

Link to post
Share on other sites

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.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...