![](https://img-blog.csdnimg.cn/20200121164548521.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjI5NzA3NQ==,size_16,color_FFFFFF,t_70)
1.直接显示int 3,可能是打开方式不对
其实是3. tab给出函数提示
2.
val a= Math.sqrt(3)
3-a*a
运行结果:
![](https://img-blog.csdnimg.cn/20200121164552641.png)
3.是val,无法更改
4.
![](https://img-blog.csdnimg.cn/20200121164552642.png)
5.找到10 、2 中较大的数
6.
var res=BigInt(2);
for (i <-1 to 1024){
res=res *res;
}
print(res)
这个方法会报错
调用函数
print(BigInt(2).pow(1024))
7.
![](https://img-blog.csdnimg.cn/20200121164552842.png)
8.
print(BigInt(Random.nextInt()).toString(36))//-7t5b5c
9.
10.
var str=“hello”
print(str.head)//h
print(str.last)//o
println(str.take(3))//hel
println(str.takeRight(3))//llo
println(str.drop(3))//lo
println(str.dropRight(3))//he