• 0 Posts
  • 73 Comments
Joined 1 year ago
cake
Cake day: July 2nd, 2023

help-circle





  • pHr34kY@lemmy.worldtoProgrammer Humor@lemmy.mlWorse than single letters
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    edit-2
    9 months ago

    You declare it as the first line after “function getNextDay() : date {”, then it is glaringly obvious that is a date variable that will (eventually) contain tomorrow’s date, and will be returned by the function.

    However, I would only use “var” if it’s initialized in the same statement. It prevents Smurf code, and the compiler knows the type straight away.

    Given a small and clean context, variable names don’t need to be specific.