- PHP Reactive Programming
- Martin Sikora
- 191字
- 2021-07-09 19:06:14
Imperative programming
Imperative programming is a programming paradigm around executing statements that change the program's state.
What this means in human language:
- Programming paradigm: This is a set of concepts defining a style of building and structuring programs. Most programming languages, such as PHP, support multiple paradigms. We can also think of it as a mindset and a way we approach problems when using such paradigms.
- Statements: Units of action with side effects in imperative programming evaluated in sequences usually containing expressions. Statements are executed for their side effects and expressions for their return value. Consider this example:
$a = 2 + 5
This line of code is a statement where
2 + 5
is an expression. The expected side effect is assigning the value7
to the$a
variable. This leads to changing the program's current state. Another statement could be, for instance:if ($a > 5) { }
This statement has one expression and no return value.
- State: Values of program variables in memory at any given time. In imperative programming, we define a series of statements that control the program's flow and, therefore, change its state.
推薦閱讀
- Go Web編程
- Bootstrap Site Blueprints Volume II
- Power Up Your PowToon Studio Project
- Functional Programming in JavaScript
- Building a Recommendation Engine with Scala
- Oracle從入門到精通(第5版)
- 網站構建技術
- 圖數據庫實戰
- Java SE實踐教程
- Geospatial Development By Example with Python
- SQL Server 入門很輕松(微課超值版)
- Node.js區塊鏈開發
- 多媒體技術及應用
- SEO教程:搜索引擎優化入門與進階(第3版)
- 算法精解:C語言描述