Try to make your code as readable as possible and less complex. When working with conditions, get rid of invalid cases first, by exiting or throwing exceptions, and do the real logic later. It's called "Early return pattern" as the functions return as soon as possible