Reputation: 31
I want to check for multiple string comparison in groovy. For example:
if (cityName in ('AHD','BLR','DEL'))
{
}
But, using this way, it is giving syntax error.
Upvotes: 0
Views: 295
Reputation: 84756
To define in-place collection use []
instead of ()
:
if (cityName in ['AHD','BLR','DEL']) {
}
Anyway, in
is used correctly.
Upvotes: 2