Quidest?

Happy path

· Lorenzo Drumond

Often, the control flow of a function has a “normal” path, the path it takes if there are no unusual or exceptional circumstances (errors, for example). This is sometimes called the happy path: it’s what happens if everything goes right.

When deciding how to write your if statements, this is a helpful rule:

Left-align the happy path. It minimises indentation and provides a clear visual guide to the reader about how you expect the program to proceed.

References

#flow #basics #errors #programming #if #golang #normal #design #control #happy_path #statement