patternrustCritical
Default function arguments in Rust
Viewed 0 times
functionrustargumentsdefault
Problem
Is it possible to create a function with a default argument?
fn add(a: int = 1, b: int = 2) { a + b }Solution
No, it is not at present. I think it likely that it will eventually be implemented, but there’s no active work in this space at present.
The typical technique employed here is to use functions or methods with different names and signatures.
The typical technique employed here is to use functions or methods with different names and signatures.
Context
Stack Overflow Q#24047686, score: 132
Revisions (0)
No revisions yet.