Use Guards And Fail Fast To Avoid Nested Condition

TopicSource
๐Ÿงน Clean CodeClean Code - Udemy

You can avoid deeply nested conditions by using guards. This means you invert the if-condition and return early in this if check. This guard protects the rest of the code, if the condition is not met and avoid it from running.

Guards make it much easier to read code by avoiding deeply nested structures.

if (!email.includes('@')) {
	return;
}

  1. Embrace refactoring - Clean code takes time