0
0

More than 3 years have passed since last update.

【Golang】if文

Posted at

【Golang】if文

Golangの基礎学習〜Webアプリケーション作成までの学習を終えたので、復習を兼ねてまとめていく。 基礎〜応用まで。

package main
//if


import "fmt"

func main(){

    a := 1
    //if else if else
    if a == 2{
        fmt.Println("2だ")
    }else if a == 1{
        fmt.Println("1だ")
    }else{
        fmt.Println("それ以外")
    }

    //内包表記
    //1行で書く
    //if 条件の; 結果がTrueなら{
        //これを表示
    //}
    if b := 100; b == 100{
        fmt.Println("100だ")
    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0