Summary
So, we have successfully understood the concept of functions in V. To briefly summarize, we began our chapter by detailing the need to write functions. Then, we looked at the syntax of a basic function and understood various terms related to defining functions. Following this, we learned how to write different types of functions such as basic functions, anonymous functions, and higher-order functions along with detailed code examples.
In the later parts of this chapter, we discovered various features such as how to define and work with functions that accept arguments, functions that return values, and function scopes, to mention a few. We also looked at how to write functions in V script files that have the .vsh
extension.
Additionally, we looked at advanced features such as how to create functions and mutable arguments and the various things to bear in mind when defining such functions. We learned how to defer the function execution flow using defer
blocks.
Having...