null
Thenull value in Soul represents the intentional absence of any value. It is a special literal that indicates that a variable has no value or that a function returns nothing meaningful.
Basic Null Usage
Assign and work with null values:Null Checking
Check if values are null:Null in Conditionals
Null is considered falsy in conditional statements:Null vs Other Falsy Values
Distinguish null from other falsy values:Null in Function Returns
Return null to indicate absence or failure:Null in Object Properties
Handle null object properties:Null in Arrays
Handle null elements in arrays:Null Coalescing
Provide default values for null:Null Safety Patterns
Safe navigation and method calls:Null in Error Handling
Use null to indicate error states:Null in Database Operations
Handle null values from database queries:Null Validation
Validate and handle null inputs:Null in Collections
Filter and handle null values in collections:Null in API Responses
Handle null values in API responses:Null Assignment Patterns
Common patterns for null assignment:Null Debugging
Debug null-related issues:Null Best Practices
Guidelines for working with null:Best Practices
- Always check for null: Validate variables before use
- Use explicit comparisons:
value == nullis clearer than!value - Provide defaults: Use default values when null is encountered
- Document null returns: Clearly indicate when functions can return null
- Handle null gracefully: Don’t let null values crash your program

