Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Putting two "if"s together
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#10
RE: Putting two "if"s together

Tip for dealing with boolean expressions:
It's worth noting that putting "==true" is redundant - because "x==true" will just evaluate to either "true" or "false" anyway. This is like stating "if saying the door is open is true", when you would normally say "if the door is open".


Likewise for using "==false", you can just use the logical not opeator "!" - e.g. "!x" is the same as "x==false".


Doing this stops a redudant equality check (which hopefully the interpreter optimises out - but it might not), and also makes the code easier to read - it's much easier to read: "if the door is not open" vs "saying the door is open is false"
(This post was last modified: 07-09-2012, 04:49 PM by Apjjm.)
07-09-2012, 04:46 PM
Find


Messages In This Thread
Putting two "if"s together - by ApeCake - 07-05-2012, 09:35 PM
RE: Putting two "if"s together - by Obliviator27 - 07-05-2012, 09:38 PM
RE: Putting two "if"s together - by Apjjm - 07-05-2012, 09:38 PM
RE: Putting two - by SilentStriker - 07-05-2012, 09:39 PM
RE: Putting two "if"s together - by himynamebob1 - 07-05-2012, 09:40 PM
RE: Putting two "if"s together - by Your Computer - 07-05-2012, 10:13 PM
RE: Putting two "if"s together - by ApeCake - 07-05-2012, 10:46 PM
RE: Putting two "if"s together - by ApeCake - 07-09-2012, 02:00 PM
RE: Putting two "if"s together - by Cruzore - 07-09-2012, 03:19 PM
RE: Putting two "if"s together - by Apjjm - 07-09-2012, 04:46 PM
RE: Putting two "if"s together - by ApeCake - 07-09-2012, 05:02 PM



Users browsing this thread: 6 Guest(s)