Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Procedural programming
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Functional programming === The principles of modularity and code reuse in [[functional programming|functional]] languages are fundamentally the same as in procedural languages, since they both stem from [[structured programming]]. For example: * Procedures correspond to functions. Both allow the reuse of the same code in various parts of the programs, and at various points of its execution. * By the same token, procedure calls correspond to function application. * Functions and their modularly separated from each other in the same manner, by the use of function arguments, return values and variable scopes. The main difference between the styles is that functional programming languages remove or at least deemphasize the imperative elements of procedural programming. The feature set of functional languages is therefore designed to support writing programs as much as possible in terms of [[pure function]]s: * Whereas procedural languages model execution of the program as a sequence of imperative commands that may implicitly alter shared state, functional programming languages model execution as the evaluation of complex expressions that only depend on each other in terms of arguments and return values. For this reason, functional programs can have a free order of code execution, and the languages may offer little control over the order in which various parts of the program are executed; for example, the arguments to a procedure invocation in [[Scheme (programming language)|Scheme]] are evaluated in an arbitrary order. * Functional programming languages support (and heavily use) [[first-class function]]s, [[anonymous function]]s and [[Closure (computer programming)|closures]], although these concepts have also been included in procedural languages at least since [[Algol 68]]. * Functional programming languages tend to rely on [[tail call optimization]] and [[higher-order function]]s instead of imperative looping constructs. Many functional languages, however, are in fact impurely functional and offer imperative/procedural constructs that allow the programmer to write programs in procedural style, or in a combination of both styles. It is common for [[input/output]] code in functional languages to be written in a procedural style. There do exist a few [[esoteric programming language|esoteric]] functional languages (like [[Unlambda]]) that eschew [[structured programming]] precepts for the sake of being difficult to program in (and therefore challenging). These languages are the exception to the common ground between procedural and functional languages.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)