assign
Assignment is the fundamental way to store values in variables in Soul. The language supports several types of assignment operations.Basic Assignment
Soul uses the=
operator for basic assignment. Variables are dynamically typed and created upon first assignment.
Compound Assignment
Soul supports compound assignment operators that combine arithmetic operations with assignment:Assignment to Collections
You can assign values to list elements and map properties:Multiple Assignment Patterns
Soul supports various assignment patterns for different data structures:Assignment in Control Flow
Assignments can be used within control flow structures:Best Practices
- Use descriptive variable names:
userCount
instead ofc
- Initialize variables: Assign initial values when declaring variables
- Consistent naming: Use camelCase for variable names
- Avoid reassigning different types: Keep variable types consistent when possible