Switter.su
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Sjmarf@sh.itjust.works to Programmer Humor@programming.dev · 1 year ago

Unused variables

sh.itjust.works

message-square
52
fedilink
886

Unused variables

sh.itjust.works

Sjmarf@sh.itjust.works to Programmer Humor@programming.dev · 1 year ago
message-square
52
fedilink
  • ValiantDust@feddit.de
    link
    fedilink
    arrow-up
    84
    arrow-down
    1
    ·
    1 year ago

    But are you gonna return something for this method??? You said you’d return an integer, yet there is no return statement!

    • gregorum@lemm.ee
      link
      fedilink
      English
      arrow-up
      42
      arrow-down
      1
      ·
      edit-2
      1 year ago

      and it had better be an integer! it had better be an integer, motherfucker!!

      • porous_grey_matter@lemmy.ml
        link
        fedilink
        arrow-up
        19
        arrow-down
        2
        ·
        edit-2
        1 year ago

        Well yea… If you write “return <object of some other type>” that is actually wrong, as opposed to just not having gotten around to filling it in yet

        • gregorum@lemm.ee
          link
          fedilink
          English
          arrow-up
          12
          arrow-down
          1
          ·
          1 year ago

    • sik0fewl@lemmy.ca
      link
      fedilink
      arrow-up
      17
      arrow-down
      1
      ·
      1 year ago

      This is why I always write my methods from bottom to top. This way I’ve always got a return statement and I use my variables before they are even declared.

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

        For a second there I thought you might be serious

        • ShouldIHaveFun@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          I do actually use variables before I declare them most of the time. IDEs make it so easy to then generate the declaration with the correct type.

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

            That’s true, in fact I’ve started doing that myself. Same with methods, instead of going and writing the method and then coming back to use it, I’ll write the invocation first.

      • N0tTheBees@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Ah an avid dreambird user I see

      • bitcrafter@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Spotted the INTERCAL programmer.

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.61K users / day
  • 4.52K users / week
  • 9.18K users / month
  • 16.5K users / 6 months
  • 1 local subscriber
  • 23.1K subscribers
  • 1.38K Posts
  • 46.7K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.10
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org