3 ms·
Afaik, the definition is just "a sequence of steps/instructions". That is of course much broader than a (simple) function, which among other things for one inpu
by zelphirkalt 2y ago
Afaik, the definition is just "a sequence of steps/instructions". That is of course much broader than a (simple) function, which among other things for one input gives you one output, and for the same input always the same output. A procedure can do that too, but it can also give you different outputs for the same input, due to side effects.
- magicalhippo 2y agoSo from that perspective functions are pure and procedures are impure? One of the thinga I miss from my C++ days was the ability to mark functions as const, which made them fairly pure. Being able to clearly mark which is which, but also to combine them easily, was very productive.
- zelphirkalt 2y agoYes, that is my understanding of the terminology, and how I try to use the terms (not always succeeding).