- Kotlin Programming By Example
- Iyanu Adelekan
- 191字
- 2021-08-27 20:00:09
Functions
A function is a block of code that can be defined once and reused any number of times. When writing programs, it is best practice to break up complex programmatic processes into smaller units that perform specific tasks. Doing this has many advantages, some of which are:
- Improving code readability: It is much easier to read programs that have been broken down into functional units. This is because the scope of the code to be understood at any given point in time is reduced when functions are utilized. The majority of the time, a programmer needs to only write or adjust a section of a large code base. When functions are utilized, the context of the program that needs to be read to ameliorate program logic is restricted to the body of the function in which the logic is written.
- Improving the maintainability of a code base: The use of functions in a code base makes it easy to maintain programs. If a change needs to be made to a particular program feature, many times it is as easy as adjusting a function in which the feature has been created.
推薦閱讀
- 一步一步學Spring Boot 2:微服務項目實戰
- Python深度學習
- Implementing Cisco Networking Solutions
- JSP開發案例教程
- Mastering Python Networking
- Mastering Xamarin.Forms(Second Edition)
- Cocos2d-x Game Development Blueprints
- WildFly Cookbook
- Apache Solr PHP Integration
- Penetration Testing with the Bash shell
- R的極客理想:量化投資篇
- Visual C++從入門到精通(第2版)
- SAP Web Dynpro for ABAP開發技術詳解:基礎應用
- AI輔助編程Python實戰:基于GitHub Copilot和ChatGPT
- Learning Spark SQL