Since C #/JavaScript/C ++/Python/Lua/Action Script has been used for many times, I am familiar with all the C series syntaxes;
When you look at the language, it will certainly be analogous to the C series. Then, let's summarize the uniqueness of the Go language to C.
- When declaring variable constants and function types, put them behind the name. This is a bit similar to as3, except to remove the colon when as3 declares the variable.
- Only struct and functions can be defined. There is no such thing as a class. That is to say, a function and a member variable cannot be put together, which is the same as C.
- If, for, and other clause conditions, do not need to use arc wrap, this is the same as python2
- The loop clause only uses for. However, this for clause is special. You can use two semicolons in it, or directly convert any condition without changing to while (true ).
- Like python, a function can return multiple values, and declare variables and assign values to multiple values in a row.
- Like python, many system functions are basically the same. Len gets the length of arrays and character characters, range can get the iterator of the loop, and make can generate a map instance. For example, M: = make (Map [String] INT)
- Like python, there is a delete, but the delete (M, "Answer ")
- Like python, it has built-in strings, arrays, and maps.
- What's more, this built-in map is actually a STD: multimap. If you call the same key once, it will become the following