memesearch
Recursive Positive Number Check

Recursive Positive Number Check

Download Find similar pictures
Text on the meme
>>> def isPositive(number): try: if(number - 1 == 0): return True else: return isPositive(number - 1) except: return False >>> isPositive(30) True >>> isPositive(0) False >>> isPositive(-100) False >>> isPositive(100) True
What it means

A Python REPL shows a recursively defined function checking whether a number is positive. The joke is that the function works for positive inputs by counting down recursively, but incorrectly returns false for zero and negative values, presenting flawed code as a cringe programming example.

Objects
Tags
Source
Type
image
Size
344×278 · 14.6 KiB
Mood
cringe, sarcastic
Language
en
Added

Similar memes