Hello world
There are three ways to write Go+’s Hello world.
The first type: command style
This is our recommended way of writing, and it is very easy to understand. Especially for elementary and middle school students, commands are the easiest logic for them to understand, which is much easier to understand than function calls.
To emphasize our preference for the command style, we introduce echo
as an alias
for println
:
The second type: function call style
This way of writing is more like Python. The basis for understanding this kind of writing is to understand what is a function call. This understanding is not too difficult, especially if middle school students have learned functions (such as sin) in mathematics classes, it is relatively easy to understand. Most programming languages also support this standard function call syntax.
The third type: software engineering style
This is a standard software engineering-based writing method that has been inherited from Go. It is not easy for beginners to understand, because they need to understand what is a function (func) and what is a package (package). Of course, it also has its benefits, starting to allow you to establish some basic logic for functional decomposition and team collaboration.
So, how do you try to play Go+?
The simplest, go directly to Go+ Playground to play:
When learning basic grammar in the early days, it can actually be done in this way.
How to install Go+ to play locally? We will talk about this topic later.
Next example: Values