Imperative and functional programming

Introduction

Imperative programming

In imperative programming, we say exactly what we want to happen. Each step changes the state.

Functional programming

With functional programming, we write functions to be called. These functions should not depend on the state, outside of local variables.

Side effects

If we remove side effects from all functions then functional programming has no global variables which could affect the output.