Unused Variables
A good practice is naming variables appropriately; however, variables may be unused at times such as the timestamp
from the call()
.
fn unused_variable() -> u64 {
let (timestamp, deposit_amount) = call();
deposit_amount
}
Named
We may preserve the name to provide context to the reader by prepending the variable with _
.
fn named_unused_variable() -> u64 {
let (_timestamp, deposit_amount) = call();
deposit_amount
}
Nameless
We may discard the context and the value by assigning it to _
.
fn nameless_variable() -> u64 {
let (_, deposit_amount) = call();
deposit_amount
}