Jump to content



Photo

Formatting long boolean expressions within if...then


  • Please log in to reply
3 replies to this topic

#1 wuschelbeutel

wuschelbeutel

    Seeker

  • Active Members
  • 20 posts

Posted 24 May 2012 - 07:50 PM

if (true or false) and (true and true) then     MsgBox(0, "The color is", "orange") EndIf


runs but

if (true or false) and (true and true) then     MsgBox(0, "The color is", "orange") EndIf


does not.

In my code, these boolean statements are actually quite long (longer than the ones in this example) and I want to put them on multiple lines.

Any suggestions?





#2 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,315 posts

Posted 24 May 2012 - 07:54 PM

You must use underscore for multiline expressions.

if (true or false) _ and _ (true and true) _ then     MsgBox(0, "The color is", "orange") EndIf

Edited by Zedna, 24 May 2012 - 07:56 PM.


#3 wuschelbeutel

wuschelbeutel

    Seeker

  • Active Members
  • 20 posts

Posted 24 May 2012 - 07:57 PM

It works. Thanks.

#4 jchd

jchd

    Whatever your capacity, resistance is futile.

  • MVPs
  • 3,250 posts

Posted 25 May 2012 - 12:25 AM

For the record, using <space> <underscore> to split an AutoIt statement on several lines works everywhere in AutoIt source, not only for conditionals, at least AFAIK.
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQL tutorial (covers generic SQL, but most of it apply to SQLite as well)An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious workPCRE v8.32 regexp pattern documentation. AutoIt uses a slightly older version so that more advanced features are not all available.RegExp tutorial: enough to get started




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users