I then proceed to define a list, populate it, and call my newly defined def. Next, I create a map and do the same thing for that collection.
然后我定义一个list,填充它,并调用我新定义的def。之后,我创建一个map,并对这个集合做了同样的操作。
Not only is writing a Groovlet as simple as creating a Groovy script but you can also define functions with the def keyword and call them directly within the Groovlet.
编写Groovlet不仅像创建一个Groovy脚本那样简单,而且还可以用def关键字定义函数,并在Groovlet中直接调用它们。
The first line of a function definition, also known as the method signature, begins with def (shorthand for define).
函数定义的第一行也称为方法签名(method signature),以def开头(def是define这个单词的缩写)。
We then use the def macro to define a constant called big-num-str.
之后,使用def宏来定义一个常量,称为big - num - str。
We then use the def macro to define a constant called big-num-str.
之后,使用def宏来定义一个常量,称为big - num - str。
应用推荐