Jump to content

Q: Boolean evaluation


Recommended Posts

If I have this statement:

if $x>0 and CreateVeryLongFile("filename") then
.
.
.
endif

With $x = 0, will the statement still execute the function CreateVeryLongFile?

I have no idea if AutoIt will or will not execute the function. From my experience/knowledge of other prog language, it should not.

However I am just curious: I have a script that for some odd reason, it is processing the 2nd argument even when the 1st argument is already false.

Link to comment
Share on other sites

Probably your $x value is a string not an integer / float. That means $x = "0" is always larger than 0 and if CreateVeryLongFile returns true than the whole expression becomes true.

 

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Probably your $x value is a string not an integer / float.

Br,

UEZ

That must be it!

I just rewrote the function and passed the $x inside the function to see it's value.

True enough it is being evaluated as TRUE!

 

Thanks!

 

Link to comment
Share on other sites

Burgaud,

As you guessed AutoIt uses lazy evaluation of conditions. This is documented in the help file under Language Reference > Operators > bottom of the page.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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