eviltoast
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
orhtej2 to Programmer Humor@programming.devEnglish · 1 year ago

Peak code reuse

message-square
41
link
fedilink
461

Peak code reuse

orhtej2 to Programmer Humor@programming.devEnglish · 1 year ago
message-square
41
link
fedilink
  • katy ✨@piefed.blahaj.zone
    link
    fedilink
    English
    arrow-up
    55
    ·
    edit-2
    1 year ago
    bool isOdd(int num) {  
    	const oddNumbers = [];  
    	for (let i = 1; i <= 10000000; i += 2) {  
      		oddNumbers.push(i);  
    	}  
    	if (oddNumbers.includes(num) {  
    		return true;  
    	}  
    }  
    
    • Malix@sopuli.xyz
      link
      fedilink
      arrow-up
      19
      ·
      1 year ago
      isOdd(-1);
      
      • dev_null@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        deleted by creator

    • moseschrute@piefed.social
      link
      fedilink
      English
      arrow-up
      11
      ·
      1 year ago

      Maybe memo just to be safe, but LGTM!

    • dependencyinjection@discuss.tchncs.de
      link
      fedilink
      arrow-up
      10
      ·
      1 year ago

      isOdd(10000001);

      • katy ✨@piefed.blahaj.zone
        link
        fedilink
        English
        arrow-up
        21
        ·
        1 year ago

        this incident has been reported

    • marcos@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      You should make it oddNumbers.includes(num%10000000)…

    • schema@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      And if not, unicorns!

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
    • If the mod doesn’t find it funny, you’re banned. Ha-ha!.. For real: do not use the community for “statements”. There are other places for such content. Keep it chill and funny.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 977 users / day
  • 3.86K users / week
  • 7.08K users / month
  • 16K users / 6 months
  • 31 local subscribers
  • 33.5K subscribers
  • 2.57K Posts
  • 99.9K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.20
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org