GO語言程式結構

來源:互聯網
上載者:User

標籤:go語言

Go程式主要由以下幾部分組成:
包聲明
匯入包
函數
變數
語句和運算式
注釋
以上一篇文章中的Test20150525.go為例:

/* 第一行定義了程式包。必須聲明為Go程式運行在什麼包。main包是起始點來運行程式。每個包都有一個與之關聯的路徑和名稱。 */package main/* import "fmt" 是告訴編譯器去包含檔案在包fmt的預先處理命令。 */import "fmt"/* func main()主要功能是為程式執行的開始。*/func main(){//注意println方法。在Go語言中,一個名字如果它用大寫字母開頭為匯出。匯出是指一個函數或變數/常訪問到相應的包匯入。fmt.Printf("Hello World!\n God Bless You!"); }

Genesis 14:13 And there came one that had escaped, and told Abram the Hebrew; for he dwelt in the plain of Mamre the Amorite brother of Eshcol, and brother of Aner ;and these were confederate with Abram.

GO語言程式結構

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.