307
submitted 8 months ago by qaz@lemmy.world to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] pHr34kY@lemmy.world 2 points 8 months ago* (last edited 8 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.

this post was submitted on 15 Oct 2023
307 points (95.3% liked)

Programmer Humor

31229 readers
1010 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 4 years ago
MODERATORS