method
Method calls in Soul allow you to invoke functions that are associated with objects, classes, or built-in types. They use dot notation to access and call methods on various data types and objects.Basic Method Calls
Call methods on objects using dot notation:Method Calls with Arguments
Pass arguments to methods:String Method Calls
Common string methods:Array/List Method Calls
Common array methods:Map/Object Method Calls
Common map methods:Chained Method Calls
Chain multiple method calls together:Method Calls on Class Instances
Call methods on class instances:Static Method Calls
Call static methods on classes:Method Calls with Variable Arguments
Methods that accept variable numbers of arguments:Method Calls with Callback Functions
Pass functions as arguments to methods:Method Calls on Built-in Types
Call methods on built-in types:Async Method Calls
Call asynchronous methods:Method Calls with Error Handling
Handle errors in method calls:Dynamic Method Calls
Call methods dynamically using variables:Method Calls in Expressions
Use method calls within expressions:Method Calls with Complex Arguments
Pass complex expressions as arguments:Method Calls on Null/Undefined
Handle null object method calls:Method Call Performance
Optimize method calls:Best Practices
- Check object existence: Verify objects exist before calling methods
- Handle errors: Use try-catch for risky method calls
- Use meaningful names: Choose descriptive method names
- Chain appropriately: Use method chaining for fluent interfaces
- Validate arguments: Check method arguments before use