Comment on I wish

<- View Parent
droans@lemmy.world ⁨6⁩ ⁨months⁩ ago

It’s only the wrong solution if you’re writing something where every operation needs to be accounted for. Modulo is a great, easy, readable method otherwise.

Not too certain on C++, but I think this would be the cleanest implementation that still somewhat optimizes itself:

private bool IsEven(int number){
    return !(number % 2)
}

source
Sort:hotnewtop