Hello world

There are three ways to write Go+’s Hello world.

The first type: command style

println "Hello world"

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:

echo "Hello world"

The second type: function call style

println("Hello world")

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

package main func main() { println("Hello world") }

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