Skip to content

Commit

Permalink
Added no-else-return message example (#6265)
Browse files Browse the repository at this point in the history
  • Loading branch information
matusvalo authored Apr 11, 2022
1 parent b733b8d commit bc85c9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/data/messages/n/no-else-return/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def compare_numbers(a: int, b: int) -> int:
if a == b: # [no-else-return]
return 0
elif a < b:
return -1
else:
return 1
6 changes: 6 additions & 0 deletions doc/data/messages/n/no-else-return/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def compare_numbers(a: int, b: int) -> int:
if a == b:
return 0
if a < b:
return -1
return 1

0 comments on commit bc85c9f

Please sign in to comment.