Skip to content

Golang “or” operator in “if” Statement

In any Golang boolean checking statement, you can use || operator instead of OR:

package main

import "fmt"

func main() {
	isEmpty := true
	isValid := true

	if !isValid || isEmpty {
		fmt.Println("This email address is not acceptable!")
	}
}

Leave a Reply

Your email address will not be published. Required fields are marked *