Thread Tools Display Modes
12-16-09, 11:06 AM   #1
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
If and and or?

Is it possible to add and "or" conditional to an if statement that already has multiple "and" conditionals?

For example:

Code:
local function LOLFUNCTION()
	if thing == "purple" and thing == "bouncy" and thing == "square" or thing == "circle" then
		return "Thingy is a purple bouncy square or circle."
	end
end
Edit: This is obviously not a real function...
  Reply With Quote
12-16-09, 11:09 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,966
Originally Posted by suicidalkatt View Post
Is it possible to add and "or" conditional to an if statement that already has multiple "and" conditionals?

For example:

Code:
local function LOLFUNCTION()
	if thing == "purple" and thing == "bouncy" and thing == "square" or thing == "circle" then
		return "Thingy is a purple bouncy square or circle."
	end
end
I would think if you bracketed things properly it should work fine.

Code:
if ( thing == "purple" and thing == "bouncy" and ( thing == "square" or thing == "circle") ) then
     return "thing is purple and bouncy and either square or circle"
end
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
12-16-09, 11:10 AM   #3
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Ah I forgot about that, thanks!
  Reply With Quote
12-16-09, 12:38 PM   #4
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Also, http://www.lua.org/pil/3.5.html
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » If and and or?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off