andioop@programming.dev to Programming Horror@programming.devEnglish · edit-211 months agoGod I wish there was an easier way to do thisprogramming.devimagemessage-square25fedilinkarrow-up12arrow-down10
arrow-up12arrow-down1imageGod I wish there was an easier way to do thisprogramming.devandioop@programming.dev to Programming Horror@programming.devEnglish · edit-211 months agomessage-square25fedilink
minus-squareMac@programming.devlinkfedilinkarrow-up1·edit-211 months agowho needs modulo when you can get less characters out of while (number > 1) { number -= 2; } return number; very efficient edit: or theres the trusty iseven api
minus-squareNullPointer@programming.devlinkfedilinkarrow-up1·11 months agohere is somewhat less: return (number % 2) == 0;
who needs modulo when you can get less characters out of
while (number > 1) { number -= 2; } return number;
very efficient
edit: or theres the trusty iseven api
here is somewhat less:
return (number % 2) == 0;
return !(number & 1);