My Lemmy Instance
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
cm0002@lemmy.zip to Programmer Humor@programming.dev · 3 days ago

More code = more better

lemmy.zip

message-square
91
fedilink
627

More code = more better

lemmy.zip

cm0002@lemmy.zip to Programmer Humor@programming.dev · 3 days ago
message-square
91
fedilink
  • OshaqHennessey@midwest.social
    link
    fedilink
    arrow-up
    61
    ·
    2 days ago
    function myFunction() {
      try {
        x = new Random().nextInt();
        if (x != 10) {
         throw "not 10";
        }
        else {
          return (10)
        }
        catch(err) {
          myFunction()
        }
      }
    }
    
    x = myFunction()
    

    Commit notes: Added error handling

    • firewallfail@lemmy.world
      link
      fedilink
      arrow-up
      58
      ·
      2 days ago

      Returning 10 instead of x when x finally ends up being 10 really ties it together.

      • OshaqHennessey@midwest.social
        link
        fedilink
        arrow-up
        26
        ·
        2 days ago

        I’m glad you noticed. That was my favorite part too.

    • NιƙƙιDιɱҽʂ@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      2 days ago

      SyntaxError: Unexpected token ‘catch’

      • OshaqHennessey@midwest.social
        link
        fedilink
        arrow-up
        8
        ·
        2 days ago

        Coding on mobile is hard

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
Visibility: Public
globe

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

  • 1.13K users / day
  • 3.98K users / week
  • 8.84K users / month
  • 18.2K users / 6 months
  • 1 local subscriber
  • 27.9K subscribers
  • 1.79K Posts
  • 61.9K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.4
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org