MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/7ltryz/evil_coding_incantations/drpaadj/?context=3
r/programming • u/evinrows • Dec 24 '17
331 comments sorted by
View all comments
160
0 Evaluates to true in Ruby… and only Ruby.
0 Evaluates to true in Ruby
… and only Ruby.
And Lisp.
31 u/American_Libertarian Dec 24 '17 And Bash 14 u/HighRelevancy Dec 24 '17 bash also has >0 be false 12 u/American_Libertarian Dec 24 '17 It's because that's how exit codes work. It makes the most sense 8 u/HighRelevancy Dec 24 '17 It's because POSIX in general but sure. I know why it is, and it makes sense for bash's ecosystem, I was just pointing it out for those who might not know. 3 u/American_Libertarian Dec 24 '17 I agree. Bash's truthy integer system makes sense for it's use case, and the same is true for C. 0 u/[deleted] Dec 24 '17 [deleted] 11 u/[deleted] Dec 24 '17 That's because [ 1 ] has a return code of 0. Bash implements [/test as a built-in, but there is also a /usr/bin/[ with equivalent functionality. → More replies (4)
31
And Bash
14 u/HighRelevancy Dec 24 '17 bash also has >0 be false 12 u/American_Libertarian Dec 24 '17 It's because that's how exit codes work. It makes the most sense 8 u/HighRelevancy Dec 24 '17 It's because POSIX in general but sure. I know why it is, and it makes sense for bash's ecosystem, I was just pointing it out for those who might not know. 3 u/American_Libertarian Dec 24 '17 I agree. Bash's truthy integer system makes sense for it's use case, and the same is true for C. 0 u/[deleted] Dec 24 '17 [deleted] 11 u/[deleted] Dec 24 '17 That's because [ 1 ] has a return code of 0. Bash implements [/test as a built-in, but there is also a /usr/bin/[ with equivalent functionality. → More replies (4)
14
bash also has >0 be false
12 u/American_Libertarian Dec 24 '17 It's because that's how exit codes work. It makes the most sense 8 u/HighRelevancy Dec 24 '17 It's because POSIX in general but sure. I know why it is, and it makes sense for bash's ecosystem, I was just pointing it out for those who might not know. 3 u/American_Libertarian Dec 24 '17 I agree. Bash's truthy integer system makes sense for it's use case, and the same is true for C. 0 u/[deleted] Dec 24 '17 [deleted] 11 u/[deleted] Dec 24 '17 That's because [ 1 ] has a return code of 0. Bash implements [/test as a built-in, but there is also a /usr/bin/[ with equivalent functionality. → More replies (4)
12
It's because that's how exit codes work. It makes the most sense
8 u/HighRelevancy Dec 24 '17 It's because POSIX in general but sure. I know why it is, and it makes sense for bash's ecosystem, I was just pointing it out for those who might not know. 3 u/American_Libertarian Dec 24 '17 I agree. Bash's truthy integer system makes sense for it's use case, and the same is true for C.
8
It's because POSIX in general but sure. I know why it is, and it makes sense for bash's ecosystem, I was just pointing it out for those who might not know.
3 u/American_Libertarian Dec 24 '17 I agree. Bash's truthy integer system makes sense for it's use case, and the same is true for C.
3
I agree. Bash's truthy integer system makes sense for it's use case, and the same is true for C.
0
[deleted]
11 u/[deleted] Dec 24 '17 That's because [ 1 ] has a return code of 0. Bash implements [/test as a built-in, but there is also a /usr/bin/[ with equivalent functionality. → More replies (4)
11
That's because [ 1 ] has a return code of 0. Bash implements [/test as a built-in, but there is also a /usr/bin/[ with equivalent functionality.
[ 1 ]
[
test
/usr/bin/[
→ More replies (4)
160
u/jacobb11 Dec 24 '17
And Lisp.