if statement in Golang

Like other programmin languages if statement is used to execute a block of code only if the specified condition evaluates to true.

 

package main

import (
	"fmt"
)

func main() {
        // Variable declaration 
	var x int
        
	fmt.Printf("Please enter a INTIGER number ")
        fmt.Scanf("%d", &x)
         
        // if statement compare x 
	if x > 0 {
		fmt.Println("it is a POSITIVE number")
	} else if x == 0 {
		fmt.Println("it is ZERO")
	} else {
		fmt.Println("it is a NEGATIVE number")
	}
}