【Groovy】groovy基本数据类型的简单用法

一、基本数据类型简介:
基础语法网址:
https://www.w3cschool.cn/groovy/groovy_basic_syntax.html

这里推荐一个groovy在线运行网址,方便简单运行测试:
http://groovy.jsrun.net/

// 条件
fail_reason = "clone_fail"
if (fail_reason == "clone_fail") {
    println "111"
// 映射
def apk_failmap = [:]
println apk_failmap.size()
if (apk_failmap.size()!=0){
    println "111"
}
// 列表
def lst = [11, 12, 13, 14]; 
def emptylst = [];

println(lst.isEmpty()); 
println(emptylst.isEmpty()); 
if (!lst.isEmpty()){
    println "111"
}
// for循环
fail_reason = "clone_fail"
for(int i = 0;i<5;i++) {
    if (fail_reason == "clone_fail") {
        println "111"
        continue
    }
    println "222"
}
posted @ 2022-05-20 11:30  爱啦啦  阅读(109)  评论(0编辑  收藏  举报