Function Declaration
Functions in Soul are declared with thesoul keyword:
Parameters and Arguments
Functions can accept multiple parameters:Soul doesn’t support default parameters or named arguments. All parameters must be provided when calling a function.
Return Values
Use thereturn keyword to return a value:
First-Class Functions
Functions are first-class values in Soul - they can be assigned to variables, passed as arguments, and returned from other functions:Assigning Functions to Variables
Functions as Arguments
Returning Functions
Anonymous Functions
Create functions without names:Closures
Functions can capture variables from their enclosing scope:Function Scope
Each function creates its own scope:Recursion
Functions can call themselves:Higher-Order Functions
Soul supports functional programming patterns:Best Practices
Use Descriptive Names
Use Descriptive Names
Keep Functions Small
Keep Functions Small
Functions should do one thing well. If a function is getting too large, consider breaking it into smaller functions.
Return Early
Return Early

