News for hackers. Stuff that matters.
Re:Railway-oriented programming by nercury on Friday June 13, 2014 @03:25AM (#7887750)
In imperative programming, your code can execute in two states, valid and not-valid. You start in valid state, then any validation failure returns you to non-valid state and you remain there. Pretty much the core of any validation technique without bells and whistles.

valid = true

if valid and not check1(): valid = false

if valid and not check2(): valid = false

...

Re:Railway-oriented programming by TheLoneWolfling on Friday June 13, 2014 @08:04AM (#7888338)
I much prefer the (equivalent) code:

if not check1(): return false

if not check2(): return false

...