コンテンツにスキップ

Go

Goについて

Sample

package main

import (
    f "fmt"     //  fmtをfとして使う
)

const const_val int = 1024

func main(){
    //  変数
    var name_var string = "fugafuga"
    name_est := name_var    //  ローカル変数
    f.Println(name_est)
    //  定数
    const value int = 100

    f.Println("test")
    f.Printf("hogehoge")

    //  if, for
    for i:=0;i<10;i++ {
        f.Println(i)
    }   
}
func loop(){
    //  while
    n:=0
    for n<10 {
        //  do something
        n++
    }

    //  無限ループ
    for {
        //  do something
    }
}

Reference


最終更新日: August 14, 2023
作成日: August 14, 2023