minus-squareneidu@feddit.nltoProgramming Horror@programming.dev•God I wish there was an easier way to do thishexbear0·edit-29 months agoMy solution in perl back in the day when I was a teenage hobbyist who didn't know about the modulus operator: Divide by 2 and use regex to check for a decimal point. if ($num / 2 =~ /\./) { return "odd" } else { return "even" } linkfedilink
minus-squareneidu@feddit.nltoAsklemmy@lemmy.ml•What's the best advice you've learned though your time on Earth (as opposed to the moon)?hexbear9·1 year ago"Pretend your nipples are laser guns, and try to shoot people you see on the street in the head. It does wonders for your posture." As someone with a horrible posture, I found this "game" to be surprisingly effective. linkfedilink
neidu@feddit.nl to Asklemmy@lemmy.ml • edit-21 year agoHow racist/controversial would this skit from the 90's be today?plus-squaremessage-squaremessage-square4 fedilinkarrow-up122
arrow-up122message-squareHow racist/controversial would this skit from the 90's be today?plus-squareneidu@feddit.nl to Asklemmy@lemmy.ml • edit-21 year agomessage-square4 Commentsfedilink
My solution in perl back in the day when I was a teenage hobbyist who didn't know about the modulus operator: Divide by 2 and use regex to check for a decimal point.
if ($num / 2 =~ /\./) { return "odd" }
else { return "even" }