Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Could use some help with "or" statement



  • Please log in to reply
2 replies to this topic
trevzilla
  • Members
  • 12 posts
  • Last active: Apr 13 2017 08:36 PM
  • Joined: 25 Feb 2014

Hello all,

 

I have a simple if statement that for some reason isn't executing. It's probably something simple like missing a comma or something mundane like that, but I don't see what I'm doing wrong. Any help out there?

MsgBox, I'm about to check first if statement, textfound is %textfound% A_index is %A_index%

 if textfound = 0 or A_index = 4 ;
 {
	MsgBox, I'm inside the first if statement.

And the code continues from there...(A.K.A I'm not missing a closing bracket...)

 

Essentially, the top message box will successfully display "textfound is 0 A_index is 2" or something similar that should make it enter the if statement, but I never see the second message box display.

 

Any ideas? Thanks in advance for any help you can offer!



Oldman
  • Members
  • 2475 posts
  • Last active: Feb 18 2015 04:57 PM
  • Joined: 01 Dec 2013
✓  Best Answer

A traditional if does not allow a "or". You have to use a if (expression).

if (textfound = 0 or A_index = 4)

Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme) ;)

L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)

Windows 3.1. Collector's Edition.     (www.avaaz.org)


trevzilla
  • Members
  • 12 posts
  • Last active: Apr 13 2017 08:36 PM
  • Joined: 25 Feb 2014

That was it! Thanks so much! :D