Best Practices and Conventions
To ensures that your code is consistent in other JVM languages that might be used in the same project, following the Java Naming Conventions is recommended. This however does not include local variables:
The names of local variables define inside methods should be all lowercase with words separated by underscores ("_"), otherwise referred to as snake_case
:
fn exampleFunction(listLength: int) {
let new_list = ArrayList<Integer> { initialCapacity: listLength }
}
A single underscore can be used for unused variables and parameters:
fn exampleFunction(_: int) {
let _ = 1 // Unused variable
}