Timeline for Function to test if exactly one of three parameters is truthy, without using equality operators
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 26, 2018 at 2:58 | vote | accept | CalamityAdam | ||
Jul 26, 2018 at 2:59 | |||||
Jul 22, 2018 at 9:40 | history | edited | hoffmale | CC BY-SA 4.0 |
deleted 120 characters in body
|
Jul 22, 2018 at 7:17 | comment | added | Ben Millwood |
I actually find this hard to read. I have to check all the ! s and all the numeric suffixes are correct, make sure every combination is covered... the explicit counting solutions match the spec much more precisely.
|
|
Jul 20, 2018 at 9:34 | comment | added | JollyJoker |
I'd say this is the best solution. There aren't too many options. Maybe avoid repetition or the word "input" by using a,b,c instead, like return (a && !b && !c) || (!a && b && !c) || (!a && !b && c) (with line breaks before the || s)
|
|
Jul 19, 2018 at 20:09 | comment | added | hoffmale | @SunnyPatel: You're right, fixed that. | |
Jul 19, 2018 at 20:09 | history | edited | hoffmale | CC BY-SA 4.0 |
deleted 12 characters in body
|
Jul 19, 2018 at 20:07 | comment | added | Sunny Patel |
I don't believe double negations !! are necessary since the result would be the same.
|
|
Jul 19, 2018 at 19:55 | history | answered | hoffmale | CC BY-SA 4.0 |