Using guards is definitely your preference though it’s hard to deny how clean it can make our code which makes it a lot easier to add in more code later.
[Updated] How you can use guards to clean up your ugly if statements in Swift.
Farhan Syed

“Guard” are more centric to the negative use case of a value being nil/non-existence. They provide for a default value being passed instead of nil to the variable or better return the memory pointer back, ensuring no further action.

Show your support

Clapping shows how much you appreciated Urmil Setia’s story.