DEV Community

loading...

Discussion on: 5 ways to refactor if/else statements in JS functions

Collapse
mtancoigne profile image
Manuel Tancoigne • Edited

I mainly develop in Ruby and that makes me love guard clauses. Even our linter enforces us to use them for the sake of readability, and it looks awesome :)

raise 'This is not possible' if impossible?

# code continues if not impossible?
Enter fullscreen mode Exit fullscreen mode
Collapse
sylwiavargas profile image
Sylwia Vargas Author

Ruby 🥰 Guard clauses 🥰 Ruby Linters 🥰