def list=[1,2,3,4,5]

assert list.pop() == 5
assert list == [1,2,3,4]

https://groovyconsole.appspot.com/

このサイトで実行したけど、エラーにならない