- Learning Scala Programming
- Vikash Sharma
- 107字
- 2021-06-30 19:07:52
Relational operators
Relational operators are used to compare two operands. We have quite enough of these, ==, !=, >, <, >= and <=. Let's try them:
scala> val equal_op = 10 == 10
equal_op: Boolean = true
scala> val not_eq_op = 10 != 10
not_eq_op: Boolean = false
scala> val gt_than_op = 10 > 10
gt_than_op: Boolean = false
scala> val gt_than_op = 11 > 10
gt_than_op: Boolean = true
scala> val lt_than_op = 11 < 10
lt_than_op: Boolean = false
scala> val gt_eq_op = 11 >= 11
gt_eq_op: Boolean = true
scala> val lt_eq_op = 11 <= 11
lt_eq_op: Boolean = true
With these operators, we compare two operands for their values, and these operations yield a Boolean result.
推薦閱讀
- Advanced Splunk
- C++程序設(shè)計(第3版)
- Spring Boot開發(fā)與測試實戰(zhàn)
- Android Studio Essentials
- 碼上行動:零基礎(chǔ)學(xué)會Python編程(ChatGPT版)
- Serverless架構(gòu)
- PLC編程與調(diào)試技術(shù)(松下系列)
- 區(qū)塊鏈技術(shù)與應(yīng)用
- C# and .NET Core Test Driven Development
- Getting Started with Python and Raspberry Pi
- Android移動應(yīng)用項目化教程
- Scrapy網(wǎng)絡(luò)爬蟲實戰(zhàn)
- Python預(yù)測分析與機器學(xué)習(xí)
- MATLAB 2020 GUI程序設(shè)計從入門到精通
- 大象:Thinking in UML(第二版)