3 ms·
Go: value := getValue() Java: int value = getValue()
by ronnier 7y ago
Go:
value := getValue()
Java:
int value = getValue()
- johnisgood 7y agoYou could do: var value int = getValue() Alternatively, use your text editor. For me, even Emacs displays the type when my cursor is on or around value, and if you put it on or around getValue(), you get its function prototype that includes its return type.
- ronnier 7y agonobody does that though. And that was the simplest example. Once you get into more complicated types things get even harder to understand.
- lossolo 7y agoFrom Java 10 this is valid Java also: var value = getValue() So it's almost exactly the same in both languages. It's not a problem for most IDEs, just hover your mouse over the value or use keyboard shortcut to get the type. This was never an issue for me in Java or Go.