The when command has a general syntax as follows:
when event-specification [modifier] {cmd ... ;}
When the event occurs, the cmds are executed.
When you get to a line or to a procedure, a command is performed. Depending upon which command is issued, this could alter your program state.