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.
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: !programmerhumor@lemmy.ml
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
Posts must be relevant to programming, programmers, or computer science.
No NSFW content.
Jokes must be in good taste. No hate speech, bigotry, etc.
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.