Start with this:
mainAgent { println(/* expression */); whi }
Use auto-completion to complete whi to the while snippet. This is the result:
whi
while
Line 5 should be indented.