76
submitted 5 days ago by m_f@midwest.social to c/loops@midwest.social
you are viewing a single comment's thread
view the rest of the comments
[-] Kraiden@kbin.earth 5 points 4 days ago

I'm sorry, but even without knowing about the mod operator, this is inefficient and over engineered. Why have a loop at all?

fun isEven(n: Int){
    return n == abs(n)
}

no loop required...

having said that, I can totally see how that was missed in a high pressure interview. I hate interviews like that!

edit: Ha ha... isEven...not isPositive... I'm tired. ignore me!

[-] petrol_sniff_king 8 points 4 days ago

I'm not following.
n == abs(n) only tells you if it's positive.

[-] Kraiden@kbin.earth 6 points 4 days ago

yes, I'm being a dumb tonight. I'm completely wrong

[-] petrol_sniff_king 3 points 4 days ago

Haha, s'all good, yo.

load more comments (8 replies)
this post was submitted on 21 Dec 2024
76 points (100.0% liked)

Fun Loops ▶️

303 readers
188 users here now

Posting interesting/cool/funny videos from Loops here

https://loops.video/

Thanks to @Bluefruit @lemmy.world for the icon and banner!

Discussion of and questions about Loops should go over in !loops@lemmy.world

If the loop you're posting isn't original content uploaded by the creator, prefix the title with [R] for "reposted". For example, [R] Cute dog.

Rules:

  1. Don't be a dick
  2. Don't make me add more rules

founded 1 month ago
MODERATORS