- 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.
推薦閱讀
- Docker and Kubernetes for Java Developers
- Building a Game with Unity and Blender
- PaaS程序設計
- Java從入門到精通(第5版)
- 數據結構(Java語言描述)
- Swift 3 New Features
- Internet of Things with Intel Galileo
- 深入淺出PostgreSQL
- Mastering Business Intelligence with MicroStrategy
- ServiceNow:Building Powerful Workflows
- Building Wireless Sensor Networks Using Arduino
- Python Data Science Cookbook
- C++程序設計
- 零基礎學C++(升級版)
- Google Adsense優化實戰