|NO.Z.00008|——————————|BigDataEnd|——|Hadoop&Scala.V08|——|Scala.v08|Scala编程|操作符|

一、操作符
### --- 操作符

~~~     Scala的算术操作符、位操作符与 Java中的效果一样的。
~~~     需要特别注意一点:Scala中的操作符都是方法
~~~     书写时推荐使用:a + b 1 to 10这种代码风格。
~~~     Scala 没有提供 ++、-- 操作符,但是可以使用+=、-=
### --- a + b 等价 a.+(b)

scala> 1 + 2
res25: Int = 3

scala> 1.+(2)
res26: Int = 3
### --- 1 to 10 等价 1.to(10)

scala> 1 to 10
res27: scala.collection.immutable.Range.Inclusive = Range 1 to 10

scala> 1.to(10)
res28: scala.collection.immutable.Range.Inclusive = Range 1 to 10

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

posted on   yanqi_vip  阅读(4)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示