Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by CrimsonRain

3 days ago

1. Just because you can use var in a place, doesn't mean you should. Use it where the type would be obvious when reading code like

  var myPotato = new PotatoBuilder.build();

not like

  var myFood = buyFood();

where buyFood has Potato as return type.

2. Even if you don't follow 1, IDEs can show you the type like

  var Potato (in different font/color) myFood = buyFood();

0 comments

CrimsonRain

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities