How to use assignment operator in Go language
In this article Xiaobian for you to introduce in detail "how to use the assignment operator of Go language", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to use the assignment operator of Go language" can help you solve your doubts.
Example
Package main
Import "fmt"
Func main () {
Var an int = 21
Var c int
C = a
Fmt.Printf ("Line 1-= operator instance, c value =% d\ n", c)
C + = a
Fmt.Printf ("Line 2-+ = operator instance, c value =% d\ n", c)
C-= a
Fmt.Printf ("Line 3-- = operator instance, c value =% d\ n", c)
C * = a
Fmt.Printf ("Line 4-* = operator instance, c value =% d\ n", c)
C / = a
Fmt.Printf ("Line 5-/ = operator instance, c value =% d\ n", c)
C = 200
C > = 2
Fmt.Printf ("Line 7-> > = operator instance, c value =% d\ n", c)
C & = 2
Fmt.Printf ("Line 8-& = operator instance, c value =% d\ n", c)
C ^ = 2
Fmt.Printf ("Line 9-^ = operator instance, c value =% d\ n", c)
C | = 2
Fmt.Printf ("Line 10-| = operator instance, c value =% d\ n", c)
}
The running result of the above instance:
Line 1-= operator instance, c value = 21 line 2-+ = operator instance, c value = 42 line 3-- = operator instance, c value = 21 line 4-* = operator instance, c value = 441 line 5-/ = operator instance, c value = 21 line 6-= operator instance, c value = 200 line 8-& = operator instance C value = 0 line 9-^ = operator instance, c value = 2 line 10-| = operator instance, c value = 2 read here, this article "how to use the assignment operator of Go language" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, welcome to follow the industry information channel.