This is a pretty basic question, but I've just been wondering.
If I use an or
operator to check if, for example, value a or b are true.
if a == true or b == true then print("Done") end
Would that print "Done" if BOTH are true at the same time? It's just something I never learned.
Thanks!
Yes
When you look at a conditional statement, read it from left to right.
Using your example...
If the first one is true in an or
statement, it has no need to check the second part of the statement. So it prints. If it were false, it would then go ahead and check the second part.
Now, if it was an and
, it would check from left to right to see if both of them were true before printing. If the first one was false, then it would not bother checking the second one.