- 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.
推薦閱讀
- Visual Studio 2012 Cookbook
- 動手玩轉Scratch3.0編程:人工智能科創教育指南
- Visual C++數字圖像模式識別技術詳解
- Learning SAP Analytics Cloud
- 編寫高質量代碼:改善C程序代碼的125個建議
- 差分進化算法及其高維多目標優化應用
- SQL經典實例(第2版)
- 零基礎趣學C語言
- Learning Laravel's Eloquent
- Terraform:多云、混合云環境下實現基礎設施即代碼(第2版)
- SQL Server數據庫管理與開發兵書
- Learning AngularJS for .NET Developers
- Swift 4從零到精通iOS開發
- Android應用開發實戰
- Windows Phone 8 Game Development