This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ackley14's profile picture

conditional conditionals?

Started by ackley14, 27 July 2015 - 12:06 AM
ackley14 #1
Posted 27 July 2015 - 02:06 AM
im wondering if its possible to do something like


if ((a == a and b == B)/> or (c == c and d == d)) then
--do stuff
end

I'd rather not have to have multiple if statments all do the same thing and unfortunately i can't really use a proper function right now (that i can think of atleast) without things getting wonky
KingofGamesYami #2
Posted 27 July 2015 - 02:09 AM
Yes. Although where you'd be comparing 8 variables like that I have no idea.

The 'and' / 'or' stuff is easily demonstrated like this:

print( true and false )
print( false and true )
print( true and true )
print( false or true )
print( false or false )

…and of course, you can combine them. Using (), you can control the "order of operations".