MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/21ezh3/javascript_equality_table/cgcyvql/?context=3
r/programming • u/vz0 • Mar 26 '14
331 comments sorted by
View all comments
17
While not JavaScript, we must not forget about Python's False Midnight.
tl;dr:
if datetime.time(0,0): print "t" else: print "f"
Prints "f".
if datetime.time(1,0): print "t" else: print "f"
Prints "t".
12 u/[deleted] Mar 26 '14 Why do so many dynamic languages have this obsession with using non-boolean values in conditionals? 1 u/ggtsu_00 Mar 27 '14 Because conditionals only care if something is zero or non-zero. Asking if any data-type is either zero or non-zero is a pretty simply and straightforward question that is easy for a programmer to understand. → More replies (2)
12
Why do so many dynamic languages have this obsession with using non-boolean values in conditionals?
1 u/ggtsu_00 Mar 27 '14 Because conditionals only care if something is zero or non-zero. Asking if any data-type is either zero or non-zero is a pretty simply and straightforward question that is easy for a programmer to understand. → More replies (2)
1
Because conditionals only care if something is zero or non-zero. Asking if any data-type is either zero or non-zero is a pretty simply and straightforward question that is easy for a programmer to understand.
→ More replies (2)
17
u/MisterSnuggles Mar 26 '14
While not JavaScript, we must not forget about Python's False Midnight.
tl;dr:
Prints "f".
Prints "t".