--- tags: decompiler title: Decmp results for continue, break and return --- # `continue`, `return`, and `break` in loops The following is an analysis of `continue`, `return`, and `break` in loops in different contexts. ## Results The environment is as follows: - Python 3.8 - Uncompyle6 | | `continue`| `break` | `return` | | -------- | -------- | -------- | ----- | | Regular | Pass✅ | Pass✅ | Pass✅ | | `try` block | Fail❌ | Pass✅ | Fail❌ | | `except` block | Fail❌ | Fail❌ | Fail❌ | | `with` block | Fail❌ | Fail❌ | Fail❌ | | `if` | Pass✅ | Pass✅ | Pass✅ | | `elif` | Pass✅ | Pass✅ | Pass✅ | | `else` | Pass✅ | Pass✅ | Pass✅ | The environment is as follows: - Python 3.8 - Decompyle3 | | `continue`| `break` | `return` | | -------- | -------- | -------- | ----- | | Regular | Pass✅ | Fail❌ | Pass✅ | | `try` block | Fail❌ | Fail❌ | Fail❌ | | `except` block | Fail❌ | Fail❌ | Fail❌ | | `with` block | Fail❌ | Fail❌ | Fail❌ | | `if` | Pass✅ | Fail❌ | Pass✅ | | `elif` | Pass✅ | Fail❌ | Pass✅ | | `else` | Pass✅ | Fail❌ | Pass✅ | The environment is as follows: - Python 3.7 - Uncompyle6 | | `continue`| `break` | `return` | | -------- | -------- | -------- | ----- | | Regular | Pass✅ | Pass✅ | Pass✅ | | `try` block | Pass✅ | Pass✅ | Pass✅ | | `except` block | Pass✅ | Pass✅ | Pass✅ | | `with` block | Pass✅ | Pass✅ | Pass✅ | | `if` | Pass✅ | Pass✅ | Pass✅ | | `elif` | Pass✅ | Pass✅ | Pass✅ | | `else` | Pass✅ | Pass✅ | Pass✅ | The environment is as follows: - Python 3.7 - Decompyle3 | | `continue`| `break` | `return` | | -------- | -------- | -------- | ----- | | Regular | Pass✅ | Pass✅ | Pass✅ | | `try` block | Pass✅ | Pass✅ | Pass✅ | | `except` block | Pass✅ | Pass✅ | Pass✅ | | `with` block | Fail❌ | Fail❌ | Pass✅ | | `if` | Pass✅ | Pass✅ | Pass✅ | | `elif` | Pass✅ | Pass✅ | Pass✅ | | `else` | Pass✅ | Pass✅ | Pass✅ | ## Code template used: - `try` code: ```python= def foo(): for tp in set(np.sctypeDict.values()): try: z=z return a except: z=z ``` - `except` code: ```python= def foo(): for tp in set(np.sctypeDict.values()): try: z=z except: return a z=z ``` - `with` code: ```python= def foo(): for tp in set(np.sctypeDict.values()): with open(f) as t: z=z return a ``` - `if` code: ```python= def foo(): for tp in set(np.sctypeDict.values()): if a: return a elif b: z=z else: z=z ``` - `elif` code: ```python= def foo(): for tp in set(np.sctypeDict.values()): if a: z=z elif b: return a else: z=z ``` - `else` code: ```python= def foo(): for tp in set(np.sctypeDict.values()): if a: z=z elif b: z=z else: return a ```