Another type is 'Booleans'. Boolean values are used to represent true and false or on and off. There are three logical operators used to represent the Boolean values,
- && for 'and'
- || for 'or'
- ! for 'not'.
While using && operators,
When both the conditions are true, i.e., true && true = true, the result is true.
When one condition is true and the other is false,
i.e., true && false = false,
false && true = false,
the result is false.
When both the conditions are false, i.e.,
false && false = false,
the result is false.
While using the || operators,
When both the conditions are true,
i.e., true || true = true, the result is true.
When one condition is true and the other is false,
i.e., true || false = true,
false || true = true,
the result is true.
When both the conditions are false, i.e.,
false || false = false,
the result is false.
While using the '!' operator, the opposite is true.
i.e., !true = false
!false = true.
Previous Posts In The Series
Introduction To 'Go' Programming Language(Learn 'Go' - Part 1)
25 Basic Keywords Of The Go Programming Language (Learn 'Go' - Part 2)
How To Set The Go Programming Environment On Your System?(Learn 'Go' - Part 3)
Create Your First Program In Go Language (Learn 'Go' - Part 4)
Strings In 'Go'(Learn 'Go' - Part 5)
Upcoming Posts
Numbers In 'Go'(Learn 'Go' - Part 7)