Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the relational operator of Go language

Shulou Source: shulou.com Published: 2022-06-01 02:34:08 10月06日 Update

Most people do not understand the knowledge points of this article "how to use the relational operator of the Go language", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use the relational operator of the Go language" article.

Example

Package main

Import "fmt"

Func main () {

Var an int = 21

Var b int = 10

If (a = = b) {

Fmt.Printf ("the first line-an equals b\ n")

} else {

Fmt.Printf ("the first line-an is not equal to b\ n")

}

If (a)

< b ) { fmt.Printf("第二行 - a 小于 b\n" ) } else { fmt.Printf("第二行 - a 不小于 b\n" ) } if ( a >

B) {

Fmt.Printf ("the third line-an is greater than b\ n")

} else {

Fmt.Printf ("the third line-an is not greater than b\ n")

}

/ * Lets change value of an and b * /

A = 5

B = 20

If (a = a) {

Fmt.Printf ("Line 5-b is greater than or equal to a\ n")

}

}

The running result of the above instance:

The first line-an is not equal to b second line-an is not less than b third line-an is greater than b fourth line-a less than or equal to b fifth line-b greater than or equal to an is about the content of this article "how to use the relational operator of Go language", I believe everyone has a certain understanding, I hope the content shared by the editor will be helpful to you, if you want to know more about the relevant knowledge Please follow the industry information channel.

Tags: Content language operator operation one line three lines five elements examples articles knowledge articles four lines value most that is more steps knowledge points results industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MySQL Shulou Information Redmi Apple