Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想检查 groovy 中的多个字符串比较。例如:
if (cityName in ('AHD','BLR','DEL')) { }
但是,使用这种方式,它会给出语法错误。
要定义就地收集使用[]而不是():
[]
()
if (cityName in ['AHD','BLR','DEL']) { }
总之,in使用正确。
in