Names and values in imperative and functional programming languages

Metadata
aliases: [Names and values in functional programming languages, Names and values in imperative programming languages]
shorthands: {}
created: 2022-07-10 22:31:24
modified: 2022-07-10 22:38:35

The case of imperative languages

In imperative languages, the values of variables may change throughout the lifecycle of the program, by executing the commands in a sequence.

This means that in imperative languages, the same name may be associated with different values.

The case of functional programming

In functional languages, names are only introduced as the formal parameters of functions and given values by function calls with actual parameters. Once a formal parameter is associated with an actual parameter value, there is no way for it to be associated with a new value. There is concept of a command which changes the value associated with a name through assignment. Thus, there is no concept of a command sequence of command repetition to enable successive changes to values associated with names.

This means that in functional languages, a name is only ever associated with one value.