2010年2月27日土曜日

hello.goの解説

チュートリアルのhello.goの下になんだか書いてありました。

Every Go source file declares, using a package statement, which package it's part of. It may also import other packages to use their facilities. This program imports the package fmt to gain access to our old, now capitalized and package-qualified, friend, fmt.Printf.

Functions are introduced with the func keyword. The main package's main function is where the program starts running (after any initialization).

String constants can contain Unicode characters, encoded in UTF-8. (In fact, Go source files are defined to be encoded in UTF-8.)

The comment convention is the same as in C++:

/* ... */
// ...

Later we'll have much more to say about printing.


* fmtって言うパッケージを読むとPrintが使えるんだぜ
* 関数は func で始めるんだぜ
* 文字列はUTF-8なんだぜ
* コメントはC++と一緒なんだぜ
* Printはあとでみっちり解説するから覚悟しとけ
って書いてあると思います。

どれもこれも見たら明らかですね。
一見当たり前のことを当たり前に解説するって言うところを押さえるあたり、
すごくよくわかって書いてるんだなーとそこは安心感。
ぼちぼちいきますよ。

0 件のコメント:

コメントを投稿