From 049a01d148c757a17e9804a2b1e42c918e29b094 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 31 May 2014 16:56:15 +0100 Subject: [PATCH] tests: Add another test for break-from-for-loop. --- tests/basics/for_break.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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()