ADT
arm-eh
ast-experimental
cleanup-dtors
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
pthread-emulation
qualifiedEnum
|
Last change
on this file since b5cff2b was 2e041e27, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago |
|
add examples directory for testing code in the paper
|
-
Property mode
set to
100644
|
|
File size:
359 bytes
|
| Line | |
|---|
| 1 | i = 0
|
|---|
| 2 | def pong():
|
|---|
| 3 | global i
|
|---|
| 4 | print( "pong" )
|
|---|
| 5 | if i < 4:
|
|---|
| 6 | yield from ping()
|
|---|
| 7 | print( "stop pong" )
|
|---|
| 8 |
|
|---|
| 9 | def ping():
|
|---|
| 10 | global i
|
|---|
| 11 | print( "ping" )
|
|---|
| 12 | i += 1
|
|---|
| 13 | if i < 5:
|
|---|
| 14 | yield from pong()
|
|---|
| 15 | print( "stop ping" )
|
|---|
| 16 |
|
|---|
| 17 | p = ping()
|
|---|
| 18 | try:
|
|---|
| 19 | next( p )
|
|---|
| 20 | except StopIteration:
|
|---|
| 21 | print( "stop" )
|
|---|
| 22 |
|
|---|
| 23 | # Local Variables: #
|
|---|
| 24 | # tab-width: 4 #
|
|---|
| 25 | # compile-command: "python3.5 pingpong.py" #
|
|---|
| 26 | # End: #
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.