As I learn Python I have encountered some different styles. I am wondering what the difference between using "else" is as opposed to just putting code outside of the "if" statement. To further explain my question, here are two blocks of code below.
x = 5
if x == 5:
return True
else:
return False
I understand that this is returning False if x != 5, but how does this code below contrast to the code above? Is it the exact same thing, or is there a slight difference? Is there a benefit of using one over the other?
x = 5
if x == 5:
return True
return False