Understanding Imperative vs Declarative Programming