About Functions
Functions are reusable blocks of code that accept parameters, perform operations, and return results.
Key Concepts:
- Parameters: Input values passed to the function
- Function Body: Code that executes when called
- Return Value: Output sent back to caller
- Reusability: Call the same function multiple times
Benefits:
- Code organization and modularity
- Avoid code duplication
- Easier testing and debugging
- Improved readability
1FUNCTION add(a, b)
2 result = a + b
3 RETURN result
4END FUNCTION
5
6// Calling the function
7output = add(param1, param2)