(postUrl, config, isLoggedIn) = getSpringSecurityLoginConfig()
我在官方文档中找不到这种语法是什么?
这是多项任务.
Groovy支持多重赋值,即可以同时分配多个变量,例如:
Run Code Online (Sandbox Code Playgroud)def (a, b, c) = [10, 20, 'foo'] assert a == 10 && b == 20 && c == 'foo'如果您愿意,可以提供类型作为声明的一部分:
Run Code Online (Sandbox Code Playgroud)def (int i, String j) = [10, 'foo'] assert i == 10 && j == 'foo'除了在声明变量时使用它也适用于现有变量:
Run Code Online (Sandbox Code Playgroud)def nums = [1, 3, 5] def a, b, c (a, b, c) = nums assert a == 1 && b == 3 && c == 5该语法适用于数组和列表,以及返回以下任一方法的方法:
Run Code Online (Sandbox Code Playgroud)def (_, month, year) = "18th June 2009".split() assert "In $month of $year" == 'In June of 2009'
| 归档时间: | 
 | 
| 查看次数: | 53 次 | 
| 最近记录: |