In this guide, we will discuss Scala Logical Operators. Try the following example program to understand all the logical operators available in Scala Programming Language.
Example
object Demo { def main(args: Array[String]) { var a = true; var b = false; println("a && b = " + (a&&b) ); println("a || b = " + (a||b) ); println("!(a && b) = " + !(a && b) ); } }
Save the above program in Demo.scala. The following commands are used to compile and execute this program.
Command
\>scalac Demo.scala \>scala Demo
Output
a && b = false a || b = true !(a && b) = true
Next Topic : Click Here
Pingback: Scala - Relational Operators | Adglob Infosystem Pvt Ltd
Pingback: Scala - Operators | Adglob Infosystem Pvt Ltd