View Single Post
Old 12-07-2012, 07:28 AM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,037
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by felgall View Post
A longer version of the same code that does exactly the same thing using if statements instead of ternary operators is:

Code:
if ((next - present) == 356) x = 2;
else if ((present - last) == 382) x = 1;
else x=  0;
Longer, but much clearer. Doubt if there is any discernable speed difference.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote