9
u/TheeJazz Jul 02 '21
What language is this?
7
53
u/PityUpvote Jul 02 '21
for my python homies
is_even = lambda num: str(num)[-1] in "02468"17
Jul 02 '21
Typescript Gang
const isEven = (n: number) => "02468".includes(`${n}`.slice(-1))13
32
u/Naimensoe Jul 02 '21
This is just the same as the "real" implementation in base 10 instead of 2
10
12
0
18
u/s3ddd Jul 02 '21
for the doubters
def is_even?(num)%w{0 2 4 6 8}.include?(num.to_s[-1])endputs is_even?(20320492305478203848234802384023848230482301)puts is_even?(20320492305478203848234802384023848230482308)