Execution of a coroutine object may be suspended by executing the suspend statement.

Consider

Sys: =
   CoObj: =
      foo:
         S1
         CoObj.suspend
         S3
         CoObj.suspend
         S5
      foo
   S2
   CoObj.resume
   S4
   CoObj.resume
   S6

 

When CoObj is executed (happens when CoObj is generated) as part of the execution/generation of Sys), CoObj starts by executing the pattern foo - foo then executes S1 followed by CoObj.suspend, which temporarily suspends execution of CoObj and returns to Sys.

Sys then executes S2 followed by CoObj.resume, which implies that execution of CoObj is resumed and S3 is executed.

Then CoObj.suspend is executed, returning to Sys, which executes S4 followed by CoObj.resume, implying that S5 is executed. 

Then foo and CoObj terminate and control returns to Sys, which executes S6.