90
cdev
6y

When even the gift mug you got from your coworkers has a bug in the code...

Comments
  • 36
    Object member drink on line 5 cannot be used as a variable.
  • 8
  • 14
    @boese Im assuming big linespacing instead of empty lines after every line.
  • 13
    Something else: if you initialize a new coffee it will always be the same thing, no need to check with an if statement.
  • 2
    There is no problem with that @Codex404 :)
  • 2
    @boese my ide saya otherwise
  • 2
    @Codex404 and mine counts the empty lines :) which ide are you using?
  • 1
    @boese ah i thought you were talking about the second message
  • 3
    Coffee.drink
    is a property and the getter doed the drinking stuff
  • 1
    @Codex404 classic :D nope, meant the first one ^^
  • 2
    @Codex404 It depends on constructor. It could have conditions that sometimes fill it with coffee.
  • 5
    But where is the while true loop?
  • 4
  • 2
    I like how the coffee refills itself and the useless property reference at the end.
  • 1
    Useless incompetent bastard co-workers strike again
  • 2
    Had to be on purpose, but where did they buy it? I feel like ruining someone’s life
  • 1
    That triggers me so bad... I need to fix it...
  • 1
    @ThreadRipper
    Naming conflict? Depends on the language
    Line 3 could be a getter where drink is clearly an action and thus should be a method/function.
  • 2
    @theKarlisK or coffee leak!
  • 2
    So this rant become a Javascript syntax skill check 😂
  • 2
    So many issues.

    1) It overwrites the coffee class.
    2) Initialized coffee should already have coffee.
    3) `coffee.drink` would return the function, not execute it.
    4) Without a loop, you can only drink or refill the coffee, once, and never both.
    5) Put a space between an if and its condition, please!
    6) Indentation! Now!
    7) 5/6 lines could be shortened to a ternary.

    let contents = new Coffee();
    while (Coffee) {
    (contents.empty ? contents.refill() : contents.drink());
    }
  • 1
    @Root so much beauty created from an ugly mug. ♥️🤣
  • 0
    @Root but put the space inside the brackets not outside
Add Comment