While imperative code tells the machine, step-by-step, what it needs to do to solve the problem, functional programming instead seeks to describe the problem mathematically so that the machine can do the rest
1 Gefällt mir
.hat Zitat gemachtletztes Jahr
As you can see, this code is very basic. What if there were many more coffee styles than just the three we have here? What if there were 20? 50? What if, in addition to size, there were organic and non-organic options. That could increase the lines of code extremely quickly! Using this method, we are telling the machine what to print for each coffee type and for each size. This is fundamentally what is wrong with imperative code.