Runtime Guards is an actively used design pattern. Guards can easily be implemented using conditions (if !x: return;), but some languages include syntax and semantics specifically for guards.
- the Runtime Guards wikipedia page
- Have a question about Runtime Guards not answered here? Email me and let me know how I can help.
Languages with Runtime Guards include haskell
Example from haskell:
f x | x > 0 = 1 | otherwise = 0
Last updated June 22nd, 2020