Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"? true :" is equivalent to just "||".


And "X && Y || Z" is usually equivalent to "X ? Y : Z".

So "nullableVariable != null ? nullableVariable.someMethodCall() : fallbackIfNullMethodCall();".


If X is true and Y is false this returns Y instead of Z which is wrong.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: