News for hackers. Stuff that matters.
Re:Castle Engine – free, os, x-platform, 2D/3D game engine u... by hellcow on Monday February 19, 2024 @09:17AM (#39429968)
Unless you’re testing if something is null or undefined, in which case a single “x != null” handles it.
Re:Castle Engine – free, os, x-platform, 2D/3D game engine u... by fzzzy on Monday February 19, 2024 @11:11AM (#39431362)
Sure. I usually just use !x for that.
Re:Castle Engine – free, os, x-platform, 2D/3D game engine u... by SamBam on Tuesday February 20, 2024 @10:28AM (#39442432)
That doesn't test if it's null or undefined, that just tests if it's not falsy.

x = 0; !x → true

y = ""; !y → true

z = null; !z → true