Comparing those two as-is is not fair, as the first code snippet also takes care of error handling.
The following are more fair comparisons:
1) Without error handling
2) With error handling
I both cases, the difference is in the imports only. That's because fmt.Scanf already specifies that it reads from os.Stdin. Setting up that part takes two imports, which are take care of by fmt.Scanf.
Thanks for your answer Rob. But I think that I am going back to Java. Since the last year I have been trying to program in C++ Python and now Go but I just don't feel comfortable with all of them. Java might be old and verbose but at least I know what I am doing and can read easily the code. The only problem is the OOP of Java that's the reason each time I give up after an average of 6 months of study. And Go does not have GUI libraries built in which I really like when I program in Java. They all said that Go is here to replace Java but it has half of the tools that Java has to be a mature language. I think it's a good language but big companies do not seem to switch to it for some reasons.. It might be a niche language.
Fred Masen wrote:Hey Rob I am back with the go programming language If you have some time, could you tell me where the bug is from my last program and post? I will appreciate. Thanks again.
I think the two languages (Go and Java) are very different, and they have different applications.
Java has over time evolved and had new features built in. It's a multi-purpose language with many different libraries and frameworks.
Go in comparison has much simpler language constructs, which IMO is a good thing as it's quite accessible to newcomers, and isn't bogged down with lots of syntactical baggage. It's also for situations where performance is a big issue as it's intended to be closer to the hardware. And of course Go does concurrency extremely well, and is without doubt the easiest language to manage multi-threading and thread synchronisation.
If you're concerned about the verbosity of your code, then a good IDE can help you a lot with auto-completion. I find that the support for Go in Visual Studio Code is excellent. It will even automatically add import statements, as Eclipse/Intellij does for Java.