SlideShare a Scribd company logo
Development with Go
- Manjitsing K. Valvi
Operators
Arithmetic operators
Operation Operator
Addition +
Subtraction -
Multiplication *
Division /
Modulus %
Increment ++
Decrement --
Operation Operator
Logical AND &&
Logical OR ||
Logical NOT !
Logical operators
Comparison operators
Operation Operator
Equal ==
Not equal !=
Less than <
Less than or equal to <=
Greater than >
Greater than or equal to >=
Decrement --
Assignment operators
= , += , -=, *= , /=, %=
Bitwise operators
Operation Operator Description
AND & Sets each bit to 1 if both bits are 1
OR | Sets each bit to 1 if one of two bits is 1
XOR ^ Sets each bit to 1 if only one of two bits is 1
Left shift <<
Shift left by pushing zeros in from the right and let the
leftmost bits fall off
Right shift >>
Shift right by pushing copies of the leftmost bit in from
the left, and let the rightmost bits fall of
● work only on integer variables having bit-patterns of equal length
var x, y = 3, 4
fmt.Printf("x + y = %dn", x+y) // Addition 7
fmt.Printf("x - y = %dn", x-y) // Subtraction -1
fmt.Printf("x * y = %dn", x*y) // Multiplication 12
fmt.Printf("x / y = %dn", x/y) // Division 0
fmt.Printf("x mod y = %dn", x%y) // Modulus 3
x++ // Increment only post increment and
// written separately, not allowed in
// Printf 4
fmt.Println(x == y) // Relational EQUAL TO false
fmt.Println(x != y) // Relational NOT EQUAL TO true
fmt.Println(x < y && x > z) // Logical AND false
fmt.Println(x < y || x > z) // Logical OR true
fmt.Println(!(x == y && x > z)) // Logical NOT true
fmt.Println("x & y =",x&y) // Bitwise AND 0
fmt.Println("x | y =", z) // Bitwise OR 15
fmt.Println("x ^ y =", z) // Bitwise XOR 15
fmt.Println("x << 1 =", z) // Bitwise Left shift 24
fmt.Println("x >> 1 =", z) // Bitwise Right shift 6
// var x1 uint=4
// z1 = x1 & y //ERROR Types not same
// Also
// var x1 float64=4.3
// z1 = x1 & y //ERROR Types not same
// Since Bitwise operators work only on integer variables having
// bit-patterns of equal length
References
● “The Go Programming Language ”,Alan A.A.Donovan,Brian W.Kernighan,Addison Wesley Publication

More Related Content

Similar to Operators

Python
PythonPython
Python Operators
Python OperatorsPython Operators
Python Operators
Adheetha O. V
 
Operators
OperatorsOperators
Operators
Kamran
 
Pythonlearn-03-Conditional.pptx
Pythonlearn-03-Conditional.pptxPythonlearn-03-Conditional.pptx
Pythonlearn-03-Conditional.pptx
VigneshChaturvedi1
 
C – operators and expressions
C – operators and expressionsC – operators and expressions
C – operators and expressions
Chukka Nikhil Chakravarthy
 
Data Handling
Data Handling Data Handling
Data Handling
bharath916489
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c language
Tanmay Modi
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
tanmaymodi4
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
jahanullah
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
guest58c84c
 
OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2
vikram mahendra
 
Decision and Control Statements.pdf
Decision and Control Statements.pdfDecision and Control Statements.pdf
Decision and Control Statements.pdf
SrishtiChakraborty5
 
This slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptxThis slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptx
ranaashutosh531pvt
 
power point presentation on topic in C++ called "OPERATORS"
power point presentation on topic in C++ called "OPERATORS"power point presentation on topic in C++ called "OPERATORS"
power point presentation on topic in C++ called "OPERATORS"
sj9399037128
 
Types of operators in C
Types of operators in CTypes of operators in C
Types of operators in C
Prabhu Govind
 
Chapter 3.3
Chapter 3.3Chapter 3.3
Chapter 3.3
sotlsoc
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
Mohammed Sikander
 
1_Python Basics.pdf
1_Python Basics.pdf1_Python Basics.pdf
1_Python Basics.pdf
MaheshGour5
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
Neeru Mittal
 
C operators ppt
C operators pptC operators ppt
C operators ppt
RajniKashyap9
 

Similar to Operators (20)

Python
PythonPython
Python
 
Python Operators
Python OperatorsPython Operators
Python Operators
 
Operators
OperatorsOperators
Operators
 
Pythonlearn-03-Conditional.pptx
Pythonlearn-03-Conditional.pptxPythonlearn-03-Conditional.pptx
Pythonlearn-03-Conditional.pptx
 
C – operators and expressions
C – operators and expressionsC – operators and expressions
C – operators and expressions
 
Data Handling
Data Handling Data Handling
Data Handling
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c language
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2
 
Decision and Control Statements.pdf
Decision and Control Statements.pdfDecision and Control Statements.pdf
Decision and Control Statements.pdf
 
This slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptxThis slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptx
 
power point presentation on topic in C++ called "OPERATORS"
power point presentation on topic in C++ called "OPERATORS"power point presentation on topic in C++ called "OPERATORS"
power point presentation on topic in C++ called "OPERATORS"
 
Types of operators in C
Types of operators in CTypes of operators in C
Types of operators in C
 
Chapter 3.3
Chapter 3.3Chapter 3.3
Chapter 3.3
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
 
1_Python Basics.pdf
1_Python Basics.pdf1_Python Basics.pdf
1_Python Basics.pdf
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
C operators ppt
C operators pptC operators ppt
C operators ppt
 

More from Manjitsing Valvi

Composite types
Composite typesComposite types
Composite types
Manjitsing Valvi
 
Basic types
Basic typesBasic types
Basic types
Manjitsing Valvi
 
Basic constructs ii
Basic constructs  iiBasic constructs  ii
Basic constructs ii
Manjitsing Valvi
 
Basic constructs i
Basic constructs  iBasic constructs  i
Basic constructs i
Manjitsing Valvi
 
Introduction to golang
Introduction to golangIntroduction to golang
Introduction to golang
Manjitsing Valvi
 
Features of go
Features of goFeatures of go
Features of go
Manjitsing Valvi
 
Error handling
Error handlingError handling
Error handling
Manjitsing Valvi
 
Pointers & functions
Pointers &  functionsPointers &  functions
Pointers & functions
Manjitsing Valvi
 
Methods
MethodsMethods
Digital marketing marketing strategies for digital world
Digital marketing  marketing strategies for digital worldDigital marketing  marketing strategies for digital world
Digital marketing marketing strategies for digital world
Manjitsing Valvi
 
Digital marketing channels
Digital marketing channelsDigital marketing channels
Digital marketing channels
Manjitsing Valvi
 
Digital marketing techniques
Digital marketing techniquesDigital marketing techniques
Digital marketing techniques
Manjitsing Valvi
 
Social media marketing &amp; managing cybersocial campaign
Social media marketing &amp; managing cybersocial campaignSocial media marketing &amp; managing cybersocial campaign
Social media marketing &amp; managing cybersocial campaign
Manjitsing Valvi
 
Creating marketing effective online store
Creating marketing effective online storeCreating marketing effective online store
Creating marketing effective online store
Manjitsing Valvi
 
Social media marketing tech tools and optimization for search engines
Social media marketing   tech tools and optimization for search enginesSocial media marketing   tech tools and optimization for search engines
Social media marketing tech tools and optimization for search engines
Manjitsing Valvi
 
Digital marketing managing cybersocial campaign
Digital marketing managing cybersocial campaignDigital marketing managing cybersocial campaign
Digital marketing managing cybersocial campaign
Manjitsing Valvi
 
Social media marketing
Social media marketingSocial media marketing
Social media marketing
Manjitsing Valvi
 

More from Manjitsing Valvi (17)

Composite types
Composite typesComposite types
Composite types
 
Basic types
Basic typesBasic types
Basic types
 
Basic constructs ii
Basic constructs  iiBasic constructs  ii
Basic constructs ii
 
Basic constructs i
Basic constructs  iBasic constructs  i
Basic constructs i
 
Introduction to golang
Introduction to golangIntroduction to golang
Introduction to golang
 
Features of go
Features of goFeatures of go
Features of go
 
Error handling
Error handlingError handling
Error handling
 
Pointers & functions
Pointers &  functionsPointers &  functions
Pointers & functions
 
Methods
MethodsMethods
Methods
 
Digital marketing marketing strategies for digital world
Digital marketing  marketing strategies for digital worldDigital marketing  marketing strategies for digital world
Digital marketing marketing strategies for digital world
 
Digital marketing channels
Digital marketing channelsDigital marketing channels
Digital marketing channels
 
Digital marketing techniques
Digital marketing techniquesDigital marketing techniques
Digital marketing techniques
 
Social media marketing &amp; managing cybersocial campaign
Social media marketing &amp; managing cybersocial campaignSocial media marketing &amp; managing cybersocial campaign
Social media marketing &amp; managing cybersocial campaign
 
Creating marketing effective online store
Creating marketing effective online storeCreating marketing effective online store
Creating marketing effective online store
 
Social media marketing tech tools and optimization for search engines
Social media marketing   tech tools and optimization for search enginesSocial media marketing   tech tools and optimization for search engines
Social media marketing tech tools and optimization for search engines
 
Digital marketing managing cybersocial campaign
Digital marketing managing cybersocial campaignDigital marketing managing cybersocial campaign
Digital marketing managing cybersocial campaign
 
Social media marketing
Social media marketingSocial media marketing
Social media marketing
 

Recently uploaded

Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
Aditya Rajan Patra
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 

Recently uploaded (20)

Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 

Operators

  • 1. Development with Go - Manjitsing K. Valvi
  • 2. Operators Arithmetic operators Operation Operator Addition + Subtraction - Multiplication * Division / Modulus % Increment ++ Decrement -- Operation Operator Logical AND && Logical OR || Logical NOT ! Logical operators
  • 3. Comparison operators Operation Operator Equal == Not equal != Less than < Less than or equal to <= Greater than > Greater than or equal to >= Decrement -- Assignment operators = , += , -=, *= , /=, %=
  • 4. Bitwise operators Operation Operator Description AND & Sets each bit to 1 if both bits are 1 OR | Sets each bit to 1 if one of two bits is 1 XOR ^ Sets each bit to 1 if only one of two bits is 1 Left shift << Shift left by pushing zeros in from the right and let the leftmost bits fall off Right shift >> Shift right by pushing copies of the leftmost bit in from the left, and let the rightmost bits fall of ● work only on integer variables having bit-patterns of equal length
  • 5. var x, y = 3, 4 fmt.Printf("x + y = %dn", x+y) // Addition 7 fmt.Printf("x - y = %dn", x-y) // Subtraction -1 fmt.Printf("x * y = %dn", x*y) // Multiplication 12 fmt.Printf("x / y = %dn", x/y) // Division 0 fmt.Printf("x mod y = %dn", x%y) // Modulus 3 x++ // Increment only post increment and // written separately, not allowed in // Printf 4 fmt.Println(x == y) // Relational EQUAL TO false fmt.Println(x != y) // Relational NOT EQUAL TO true fmt.Println(x < y && x > z) // Logical AND false fmt.Println(x < y || x > z) // Logical OR true fmt.Println(!(x == y && x > z)) // Logical NOT true
  • 6. fmt.Println("x & y =",x&y) // Bitwise AND 0 fmt.Println("x | y =", z) // Bitwise OR 15 fmt.Println("x ^ y =", z) // Bitwise XOR 15 fmt.Println("x << 1 =", z) // Bitwise Left shift 24 fmt.Println("x >> 1 =", z) // Bitwise Right shift 6 // var x1 uint=4 // z1 = x1 & y //ERROR Types not same // Also // var x1 float64=4.3 // z1 = x1 & y //ERROR Types not same // Since Bitwise operators work only on integer variables having // bit-patterns of equal length
  • 7. References ● “The Go Programming Language ”,Alan A.A.Donovan,Brian W.Kernighan,Addison Wesley Publication