diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-21 23:48:04 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-21 23:48:04 +0000 |
commit | 600ae734cf3d0ca5274086b897f1ebaf20cf9d20 (patch) | |
tree | 5d05831a589eb5dd614a23dfae01c0fae74f0b93 /tests/basics/continue.py | |
parent | 2c302563820d18be5fcfed406582ea5edaa6b39f (diff) | |
download | micropython-600ae734cf3d0ca5274086b897f1ebaf20cf9d20.tar.gz micropython-600ae734cf3d0ca5274086b897f1ebaf20cf9d20.zip |
py: Implement break and continue byte codes, and add tests.
Also fixes a bug in the for-in-range optimiser.
I hope to remove break and continue byte codes in the future and just
use jump (if possible).
Diffstat (limited to 'tests/basics/continue.py')
-rw-r--r-- | tests/basics/continue.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/basics/continue.py b/tests/basics/continue.py new file mode 100644 index 0000000000..6b388d5cae --- /dev/null +++ b/tests/basics/continue.py @@ -0,0 +1,16 @@ +for i in range(4): + print('one', i) + if i > 2: + continue + print('two', i) + +for i in range(4): + print('one', i) + if i < 2: + continue + print('two', i) + +for i in [1, 2, 3, 4]: + if i == 3: + continue + print(i) |