MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/oul365/from_the_codebase_that_brought_you_stdstring_comma/h75fy23/
r/badcode • u/uruharushia • Jul 30 '21
84 comments sorted by
View all comments
Show parent comment
3
you can do in with integers too, dont know why you would but this works:
int a = 0; if( (a=2) == 2 ) // true
2 u/[deleted] Jul 31 '21 Well technically the truth but in this case you need to actively add parentheses which kind of removes the "by mistake" aspect 1 u/MorphTheMoth Jul 31 '21 oh right, the c# compiler gives an error if you implicitly cast an int into a bool
2
Well technically the truth but in this case you need to actively add parentheses which kind of removes the "by mistake" aspect
1 u/MorphTheMoth Jul 31 '21 oh right, the c# compiler gives an error if you implicitly cast an int into a bool
1
oh right, the c# compiler gives an error if you implicitly cast an int into a bool
View all comments
Show parent comment
3
u/MorphTheMoth Jul 31 '21
you can do in with integers too, dont know why you would but this works: