diff options
author | Damien George <damien.p.george@gmail.com> | 2014-05-31 16:56:15 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-05-31 16:56:15 +0100 |
commit | 049a01d148c757a17e9804a2b1e42c918e29b094 (patch) | |
tree | f8692dcae6f59dc1127a5d0d49099221aebf7f9a | |
parent | ff8da0b835e94462e6b5da6fbe48409fdff40b28 (diff) | |
download | micropython-049a01d148c757a17e9804a2b1e42c918e29b094.tar.gz micropython-049a01d148c757a17e9804a2b1e42c918e29b094.zip |
tests: Add another test for break-from-for-loop.
-rw-r--r-- | tests/basics/for_break.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/basics/for_break.py b/tests/basics/for_break.py index fa8dabd150..f8bb0578e2 100644 --- a/tests/basics/for_break.py +++ b/tests/basics/for_break.py @@ -13,3 +13,15 @@ def foo(): i -= 1 foo() + +# break from within nested for loop +def bar(): + l = [1, 2, 3] + for e1 in l: + print(e1) + for e2 in l: + print(e1, e2) + if e2 == 2: + break + +bar() |