1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# === Bare return statement ===
# Test functions with bare return (no value)
def early_exit():
return
assert early_exit() is None
def conditional_early_exit(x):
if x < 0:
return
return x * 2
assert conditional_early_exit(-5) is None
assert conditional_early_exit(5) == 10
def multiple_bare_returns(x):
if x == 0:
return
if x == 1:
return
return x
assert multiple_bare_returns(0) is None
assert multiple_bare_returns(1) is None
assert multiple_bare_returns(2) == 2
def nested_bare_return():
def inner():
return
return inner()
assert nested_bare_return() is None