Why Use Local Functions?

With time and practice you will see that when you are writing code, you often need methods that you only need once, or the method we need gets very long. We said earlier that when a method contains too many lines of code it becomes hard to read and maintain. This is where local functions come to help - they help us to declare a new method in another one we already have, and it will be used only once. This helps our code to be ordered better and easier to read, which helps for faster correction if there is an error in the code and limits the possibility for mistakes when maknig changes in the program logic.

results matching ""

    No results matching ""