def someList = [1,2,3] def foo = { v = null -> v ? someList[0] = v : someList.first() } println foo() foo('moo') println foo()