God I wish there was an easier way to do thisprogramming.devimage andioop ( @andioop@programming.dev ) Programming Horror@programming.devEnglish • edit-210 months ago message-square27fedilinkarrow-up1115
arrow-up1115imageGod I wish there was an easier way to do thisprogramming.dev andioop ( @andioop@programming.dev ) Programming Horror@programming.devEnglish • edit-210 months ago message-square27fedilink
minus-square Mac ( @mac@programming.dev ) linkfedilink12•edit-210 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-square NullPointer ( @nullPointer@programming.dev ) linkfedilink6•10 months agohere is somewhat less: return (number % 2) == 0;
minus-square perviouslyiner ( @perviouslyiner@lemm.ee ) linkfedilinkEnglish2•10 months agoare the negative numbers all even?
who needs modulo when you can get less characters out of
very efficient
edit: or theres the trusty iseven api
here is somewhat less:
return (number % 2) == 0;
are the negative numbers all even?
Yes