identifier
Identifiers in Soul are names used to identify variables, functions, classes, and other program elements. They are fundamental building blocks that allow you to reference and manipulate data throughout your program.Basic Identifiers
Simple variable names:Identifier Rules
Valid identifier naming rules:Naming Conventions
Recommended naming patterns:Variable Identifiers
Variables with different scopes:Function Identifiers
Function names as identifiers:Class and Object Identifiers
Class names and object properties:Property Identifiers
Object property access:Array and Map Identifiers
Collection variable names:Loop Variable Identifiers
Identifiers in loops:Function Parameter Identifiers
Parameter names in functions:Private-like Identifiers
Convention for private variables:Constant-like Identifiers
Convention for constants:Namespace Identifiers
Module and namespace identifiers:Special Identifiers
Reserved and special identifiers:Dynamic Identifiers
Identifiers created dynamically:Identifier Validation
Checking identifier validity:Best Practices
- Use descriptive names:
userAccountBalance
instead ofbal
- Be consistent: Choose one naming convention and stick to it
- Avoid abbreviations:
firstName
instead offName
- Use meaningful prefixes:
is
for booleans,get
for getters - Avoid reserved words: Don’t use language keywords as identifiers