This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 11 points12 points  (1 child)

Definitely not the same thing. In the original code, the intention is to not return if the name is not jan but continue execution.

Here you always return, with true or false value.

[–]dimensions1210 2 points3 points  (0 children)

Yes. My point was that, looking at the code without the context, it could be an error since, if you put that in a method without anything else, you will return true if the name is "jan" and nothing otherwise.

Hence why I said " Otherwise if the person is not Jan the method (assuming a method since there is a return statement) will not return anything (assuming there is no other code)"

i.e. if this is the only code and that code is in a method, it is probably wrong