当前位置:网站首页>Scope of groovy
Scope of groovy
2022-06-23 13:32:00 【Leisurely summer】
1、range How to define
Groovy Medium range The definition is a number before and after , And then in the middle .. separation , Represents a range
def range = 1..10 // Express 1~102、Groovy Common methods in
Range Inherited Java In the List Interface , therefore groovy Method of list operation in , Yes range It still applies
2.1、 Get value
range[0]2.2、contains Method
Check whether the scope contains an element , The return value is of boolean type
range.contains(10) // Boolean type 2.3、from Method to get the upper boundary of the range
range.from2.4、to Method to get the lower boundary of the range
range.to3、 Range traversal
range.each { // groovy The way , Recommended
println it
}
for (i in range) { // Java The way
println i
}4、 The scope is switch case The use of
def result = getGrade(99)
println result
def getGrade(Number number) {
def result
switch (number) {
case 0..<60:
result = ' fail, '
break
case 60..<70:
result = ' pass '
break
case 70..<80:
result = ' good '
break
case 80..100:
result = ' good '
break
}
return result // return It can be omitted
}边栏推荐
- 1 channel 100m optical fiber transceiver 1 100m optical 1 100m electric desktop Ethernet optical fiber transceiver built-in power supply
- 2-optical-2-electric cascaded optical fiber transceiver Gigabit 2-optical-2-electric optical fiber transceiver Mini embedded industrial mine intrinsic safety optical fiber transceiver
- R语言使用nnet包的multinom函数构建无序多分类logistic回归模型、使用回归系数及其标准误计算每个系数对应的Z统计量的值、使用pnorm函数计算Z统计量对应的p值判断变量的显著性
- 首次曝光!唯一全域最高等级背后的阿里云云原生安全全景图
- Hanyuan hi tech 1-channel gigabit optical port to 4-channel Gigabit Ethernet electrical port Gigabit 1-optical 4-electric optical fiber transceiver
- Technology sharing | wvp+zlmediakit realizes streaming playback of camera gb28181
- Part C - value types and reference types
- R language uses the multinom function of NNET package to build a disordered multi classification logistic regression model, uses regression coefficients and their standard errors to calculate the valu
- 4-way telephone +1-way Gigabit Ethernet 4-way PCM telephone optical transceiver
- Analyse et résolution des défaillances de connexion causées par MySQL utilisant replicationconnection
猜你喜欢

Oracle中dbms_output.put_line怎么使用

Quarkus+saas multi tenant dynamic data source switching is simple and perfect
kubernetes日志监控系统架构详解

Go寫文件的權限 WriteFile(filename, data, 0644)?

Online text filter less than specified length tool

#云原生征文#深入了解Ingress

LM05丨曾经的VIX(二代产品)

4-way telephone +1-way Gigabit Ethernet 4-way PCM telephone optical transceiver

Gradle Build Cache引发的Task缓存编译问题怎么解决

Qunhui 10 Gigabit network configuration and test
随机推荐
What a talented company that can turn SAP system into a chicken rib!
理财产品长期是几年?新手最好买长期还是短期?
The way out after the development of Internet technology -- the birth of IVX
Gradle Build Cache引发的Task缓存编译问题怎么解决
Go寫文件的權限 WriteFile(filename, data, 0644)?
The redis keys command should be used with caution in the production environment. It is best to shield it
支持HomeKit、NFC:智汀智能门锁SL1仅需要149元
Unity small demand - simple realization of imitation King Diamond (single draw)
AssetBundle resource management
Hanyuan high tech USB2.0 optical transceiver USB2.0 optical fiber extender USB2.0 optical fiber transmitter USB2.0 interface to optical fiber
"Four highs" of data midrange stability | startdt Tech Lab 18
1 channel 100m optical fiber transceiver 1 100m optical 1 100m electric desktop Ethernet optical fiber transceiver built-in power supply
Go写文件的权限 WriteFile(filename, data, 0644)?
Packaging and unpacking process of ESP message under IPSec transmission mode
实战 | 如何制作一个SLAM轨迹真值获取装置?
64 channel PCM telephone optical transceiver 64 channel telephone +2-channel 100M Ethernet telephone optical transceiver 64 channel telephone PCM voice optical transceiver
Js: get the maximum zindex (Z-index) value of the page
Principle analysis of three methods for exchanging two numbers
Online text filter less than specified length tool
Cifar announces the second stage pan Canadian AI strategy