summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/for_break.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics/for_break.py')
-rw-r--r--tests/basics/for_break.py12
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()