Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use assignment operator in Go language

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report