w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Why passing an inline list into println method isn't working in Groovy? (like 'println [1, 2, 3]')

Groovy sees an expression identifier[index] as a syntatic sugar to identifier.getAt(index) which takes precedence over a identifier([index]). So it is trying to treat println as a variable and getting [1, 2, 3] from it.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.