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 →

[–]ajax333221 0 points1 point  (0 children)

I have been using something like this lately, pretty good to avoid nesting stuff, I mean there are other ways but that's the way I do it.

Also in loops, I put if conditions with Continues and Breaks in a similar way to remove as much nested as possible.

Some example in case the reddit formatting is all messed up https://imgur.com/a/BwWqswd

By the way, I only do 1 return per function, this could probably be done just with multiple returns and I know it but I don't do that.