Lemmy.eus
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
cm0002@lemmy.zip to Programmer Humor@programming.dev · 1 day ago

More code = more better

lemmy.zip

message-square
72
fedilink
570

More code = more better

lemmy.zip

cm0002@lemmy.zip to Programmer Humor@programming.dev · 1 day ago
message-square
72
fedilink
  • OshaqHennessey@midwest.social
    link
    fedilink
    arrow-up
    53
    ·
    1 day 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
      50
      ·
      1 day ago

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

      • OshaqHennessey@midwest.social
        link
        fedilink
        arrow-up
        21
        ·
        1 day ago

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

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

      SyntaxError: Unexpected token ‘catch’

      • OshaqHennessey@midwest.social
        link
        fedilink
        arrow-up
        7
        ·
        1 day 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.

  • 472 users / day
  • 3.71K users / week
  • 8.79K users / month
  • 16.3K users / 6 months
  • 3 local subscribers
  • 27.9K subscribers
  • 1.78K Posts
  • 42.6K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.7
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org