If Statement in Golang

Create new folder named src. In src folder, create new file named main.go as below:

package main

import "fmt"

func main() {

	var a int = 5
	if a > 2 {
		fmt.Println("a > 2")
	}

	var b int = 10
	if b > 4 && b % 2 == 0 {
		fmt.Println("b > 4 and b is an even number")
	}

}




Open Terminal windows in Visual Studio Code and run command line: go run main.go

a > 2
b > 4 and b is an even number